From 7ec9ca2db158860a1ddd0bf02140d09d26812259 Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Mon, 10 Aug 2020 22:42:13 +0200 Subject: [PATCH] pass incoming phone number to the ring hook (allows distinctive rings/actions based on caller) and added a similar sms hook --- scripts/modem/sxmo_modemmonitor.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 5bf602d..58a9ee6 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -53,6 +53,12 @@ checkforincomingcalls() { tr -d ' +' ) + if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/ring" ]; then + "$XDG_CONFIG_HOME/sxmo/hooks/ring" "$(sxmo_contacts.sh | grep -E "^$INCOMINGNUMBER")" + else + sxmo_vibratepine 2000 & + fi + # Log to /tmp/incomingcall to allow pickup and log into modemlog TIME="$(date --iso-8601=seconds)" mkdir -p "$LOGDIR" @@ -96,6 +102,10 @@ checkfornewtexts() { "st -e tail -n9999 -f $LOGDIR/$NUM/sms.txt" \ "$LOGDIR/$NUM/sms.txt" \ "Message from $(sxmo_contacts.sh | grep -E "^$NUM:"): $TEXT" & + + if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/sms" ]; then + "$XDG_CONFIG_HOME/sxmo/hooks/sms" "$(sxmo_contacts.sh | grep -E "^$INCOMINGNUMBER")" "$TEXT" + fi done }