diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh index 9785063..1acc638 100755 --- a/scripts/core/sxmo_contacts.sh +++ b/scripts/core/sxmo_contacts.sh @@ -3,6 +3,8 @@ # modem log merged with contact names defined in contacts file tsv. # Wherein $CONTACTSFILE is tsv with two fields: number\tcontact name # Wherein $LOGFILE is *sorted* tsv with three fields: date\tevt\tnumber +# +# number should be a full phone number starting with + and the country number # # Prints in output format: "number: contact" @@ -14,14 +16,14 @@ contacts() { RECENTCONTACTEDNUMBERSREVCHRON="$( cut -f3 "$LOGFILE" | tac | - awk '!($0 in a){a[$0];print}' | + awk '!($0 in a){a[$0]; if (substr($0,1,1) == "+") print}' | sed '/^[[:space:]]*$/d' )" printf %b "$RECENTCONTACTEDNUMBERSREVCHRON" | awk -F'\t' ' FNR==NR{a[$1]=$2; next} { if (!a[$1]) a[$1] = "Unknown Number"; - print $0 ": " a[$1] + if (substr($0,1,1) == "+") print $0 ": " a[$1] } ' "$CONTACTSFILE" - } diff --git a/scripts/modem/sxmo_modemcall.sh b/scripts/modem/sxmo_modemcall.sh index d612bc0..279a36d 100755 --- a/scripts/modem/sxmo_modemcall.sh +++ b/scripts/modem/sxmo_modemcall.sh @@ -41,7 +41,7 @@ vid_to_number() { mmcli -m "$(modem_n)" -o "$1" -K | grep call.properties.number | cut -d ':' -f2 | - tr -d ' +' + tr -d ' ' } log_event() { diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index 4707631..8c6c804 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -103,7 +103,7 @@ checkfornewtexts() { NUM="$( echo "$TEXTDATA" | grep sms.content.number | - sed -E 's/^sms\.content\.number\s+:\s+[+]?//' + sed -E 's/^sms\.content\.number\s+:\s+//' )" TIME="$(echo "$TEXTDATA" | grep sms.properties.timestamp | sed -E 's/^sms\.properties\.timestamp\s+:\s+//')" diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index 3c0165d..0b62a3d 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -64,7 +64,7 @@ sendtextmenu() { awk NF | menu sxmo_dmenu_with_kb.sh -p "Number" -fn "Terminus-20" -l 10 -c -i | cut -d: -f1 | - tr -d -- '-+ ' + tr -d -- '- ' )" echo "$NUMBER" | grep -E "^Cancel$" && exit 1 echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number"