Remove +1 stripping from numbers in modem scripts

Note prefix stripping was unreliable because any +1XX number would break things.
The advice should be to always dial with +1 / international prefixes and store
contacts in your contacts.tsv with international codes; this way we avoid any
duplicate errors since we can be assured things in mmcli always come back w/
international prefixing automatically.
master
Miles Alan 5 years ago
parent 9f930e742a
commit a032e4923e
  1. 4
      scripts/modem/sxmo_modemcall.sh
  2. 7
      scripts/modem/sxmo_modemdial.sh
  3. 7
      scripts/modem/sxmo_modemmonitor.sh
  4. 2
      scripts/modem/sxmo_modemtext.sh

@ -34,9 +34,7 @@ vid_to_number() {
mmcli -m "$(modem_n)" -o "$1" -K | mmcli -m "$(modem_n)" -o "$1" -K |
grep call.properties.number | grep call.properties.number |
cut -d ':' -f2 | cut -d ':' -f2 |
tr -d ' ' | tr -d ' '
sed 's/^[+]//' |
sed 's/^1//'
} }
log_event() { log_event() {

@ -25,12 +25,7 @@ dialmenu() {
)" )"
echo "$NUMBER" | grep "Close Menu" && kill 0 echo "$NUMBER" | grep "Close Menu" && kill 0
NUMBER="$( NUMBER="$(echo "$NUMBER" | cut -d: -f1 tr -d '- ')"
echo "$NUMBER" |
awk -F' ' '{print $NF}' |
tr -d - |
cut -f2
)"
echo "$NUMBER" | grep -qE '^[+0-9]+$' || fatalerr "$NUMBER is not a number" echo "$NUMBER" | grep -qE '^[+0-9]+$' || fatalerr "$NUMBER is not a number"
echo "Attempting to dial: $NUMBER" >&2 echo "Attempting to dial: $NUMBER" >&2

@ -50,8 +50,7 @@ checkforincomingcalls() {
mmcli -m "$(modem_n)" --voice-list-calls -o "$VOICECALLID" -K | mmcli -m "$(modem_n)" --voice-list-calls -o "$VOICECALLID" -K |
grep call.properties.number | grep call.properties.number |
cut -d ':' -f 2 | cut -d ':' -f 2 |
sed 's/^[+]//' | tr -d ' '
sed 's/^1//'
) )
# Log to /tmp/incomingcall to allow pickup and log into modemlog # Log to /tmp/incomingcall to allow pickup and log into modemlog
@ -86,9 +85,7 @@ checkfornewtexts() {
NUM="$( NUM="$(
echo "$TEXTDATA" | echo "$TEXTDATA" |
grep sms.content.number | grep sms.content.number |
sed -E 's/^sms\.content\.number\s+:\s+[+]?//' | sed -E 's/^sms\.content\.number\s+:\s+[+]?//'
sed 's/^[+]//' |
sed 's/^1//'
)" )"
TIME="$(echo "$TEXTDATA" | grep sms.properties.timestamp | sed -E 's/^sms\.properties\.timestamp\s+:\s+//')" TIME="$(echo "$TEXTDATA" | grep sms.properties.timestamp | sed -E 's/^sms\.properties\.timestamp\s+:\s+//')"

@ -22,7 +22,7 @@ editmsg() {
sendmsg() { sendmsg() {
MODEM="$(modem_n)" MODEM="$(modem_n)"
NUMBER="$(echo "$1" | sed 's/^[+]//' | sed 's/^1//')" NUMBER="$1"
TEXT="$2" TEXT="$2"
TEXTSIZE="${#TEXT}" TEXTSIZE="${#TEXT}"

Loading…
Cancel
Save