diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh index 471c2c9..56d483c 100755 --- a/scripts/core/sxmo_contacts.sh +++ b/scripts/core/sxmo_contacts.sh @@ -16,14 +16,14 @@ contacts() { RECENTCONTACTEDNUMBERSREVCHRON="$( cut -f3 "$LOGFILE" | tac | - awk '!($0 in a){a[$0]; if (substr($0,1,1) == "+") print}' | + awk '!($0 in a){a[$0]; print}' | sed '/^[[:space:]]*$/d' )" printf %b "$RECENTCONTACTEDNUMBERSREVCHRON" | awk -F'\t' ' FNR==NR{a[$1]=$2; next} { if (!a[$1]) a[$1] = "Unknown Number"; - if (substr($0,1,1) == "+") print $0 ": " a[$1] + print $0 ": " a[$1] } ' "$CONTACTSFILE" - } diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index a1893b7..a2825ae 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -46,7 +46,7 @@ checkformissedcalls() { mkdir -p "$LOGDIR" printf %b "$TIME\tcall_missed\t$MISSEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" - CONTACT="$(sxmo_contacts.sh | grep -E "^\\$MISSEDNUMBER")" + CONTACT="$(sxmo_contacts.sh | grep -F "^${MISSEDNUMBER//+/\\+}:")" sxmo_notificationwrite.sh \ random \ "st -f Terminus-20 -e sh -c \"echo 'Missed call from $CONTACT at $(date)' && read\"" \ @@ -69,7 +69,7 @@ checkforincomingcalls() { INCOMINGNUMBER=$(lookupnumberfromcallid "$VOICECALLID") if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/ring" ]; then - "$XDG_CONFIG_HOME/sxmo/hooks/ring" "$(sxmo_contacts.sh | grep -E "^\\$INCOMINGNUMBER")" & + "$XDG_CONFIG_HOME/sxmo/hooks/ring" "$(sxmo_contacts.sh | grep -E "^${INCOMINGNUMBER//+/\\+}:")" & else sxmo_vibratepine 2500 & fi @@ -82,7 +82,7 @@ checkforincomingcalls() { "$NOTIFDIR/incomingcall_${VOICECALLID}_notification" \ "sxmo_modemcall.sh pickup $VOICECALLID" \ none \ - "Pickup - $(sxmo_contacts.sh | grep -E "^\\$INCOMINGNUMBER")" & + "Pickup - $(sxmo_contacts.sh | grep -E "^${INCOMINGNUMBER//+/\\+}:")" & echo "Number: $INCOMINGNUMBER (VOICECALLID: $VOICECALLID)" } @@ -115,10 +115,10 @@ checkfornewtexts() { random \ "st -e tail -n9999 -f '$LOGDIR/$NUM/sms.txt'" \ "$LOGDIR/$NUM/sms.txt" \ - "Message - $(sxmo_contacts.sh | grep -E "^\\$NUM"): $TEXT" + "Message - $(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 "^\\$NUM")" "$TEXT" + "$XDG_CONFIG_HOME/sxmo/hooks/sms" "$(sxmo_contacts.sh | grep -E "^${NUM//+/\\+}:")" "$TEXT" fi done }