diff --git a/scripts/core/sxmo_contacts.sh b/scripts/core/sxmo_contacts.sh index 1acc638..bdddc7a 100755 --- a/scripts/core/sxmo_contacts.sh +++ b/scripts/core/sxmo_contacts.sh @@ -28,4 +28,14 @@ contacts() { ' "$CONTACTSFILE" - } -contacts +all_contacts() { + cat "$CONTACTSFILE" | awk -F'\t' '{ + if (substr($0,1,1) == "+") print $1 ": " $2 + }' | sort -f -k 2 +} + +if [ "$1" = "--all" ]; then + all_contacts +else + contacts +fi diff --git a/scripts/modem/sxmo_modemdial.sh b/scripts/modem/sxmo_modemdial.sh index 711144d..66ff8a9 100755 --- a/scripts/modem/sxmo_modemdial.sh +++ b/scripts/modem/sxmo_modemdial.sh @@ -18,7 +18,12 @@ modem_n() { dialmenu() { CONTACTS="$(sxmo_contacts.sh)" NUMBER="$( - printf %b "Close Menu\n$CONTACTS" | + printf %b "Close Menu\nMore contacts\n$CONTACTS" | + grep . | + sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i + )" + echo "$NUMBER" | grep "More contacts" && NUMBER="$( + printf %b "Close Menu\n$(sxmo_contacts.sh --all)" | grep . | sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i )" @@ -29,8 +34,8 @@ dialmenu() { echo "Attempting to dial: $NUMBER" >&2 CALLID="$( - mmcli -m "$(modem_n)" --voice-create-call "number=$NUMBER" | - grep -Eo "Call/[0-9]+" | + mmcli -m "$(modem_n)" --voice-create-call "number=$NUMBER" | + grep -Eo "Call/[0-9]+" | grep -oE "[0-9]+" )" echo "Starting call with CALLID: $CALLID" >&2 diff --git a/scripts/modem/sxmo_modemtext.sh b/scripts/modem/sxmo_modemtext.sh index cb9bf46..08287fc 100755 --- a/scripts/modem/sxmo_modemtext.sh +++ b/scripts/modem/sxmo_modemtext.sh @@ -38,13 +38,20 @@ choosenumbermenu() { # Prompt for number NUMBER="$( - printf %b "\nCancel\n$(sxmo_contacts.sh)" | + printf %b "\nCancel\nMore contacts\n$(sxmo_contacts.sh)" | awk NF | menu sxmo_dmenu_with_kb.sh -p "Number" -fn "Terminus-20" -l 10 -c -i | cut -d: -f1 | tr -d -- '- ' )" - echo "$NUMBER" | grep -E "^Cancel$" && exit 1 + echo "$NUMBER" | grep -qE "^Morecontacts$" && NUMBER="$( #joined words without space is not a bug + printf %b "\nCancel\n$(sxmo_contacts.sh --all)" | + grep . | + sxmo_dmenu_with_kb.sh -l 10 -p Number -c -fn Terminus-20 -i + cut -d: -f1 | + tr -d -- '- ' + )" + echo "$NUMBER" | grep -qE "^Cancel$" && exit 1 echo "$NUMBER" | grep -qE '^[+0-9]+$' || err "That doesn't seem like a valid number" echo "$NUMBER" }