|
|
@ -35,6 +35,21 @@ modem_n() { |
|
|
|
err "Couldn't find modem - is your modem enabled? Disabling modem monitor" |
|
|
|
err "Couldn't find modem - is your modem enabled? Disabling modem monitor" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cleanupnumber() { |
|
|
|
|
|
|
|
if pn valid "$1"; then |
|
|
|
|
|
|
|
echo "$1" |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REFORMATTED="$(pn find ${DEFAULT_COUNTRY:+-c "$DEFAULT_COUNTRY"} "$1")" |
|
|
|
|
|
|
|
if [ -n "$REFORMATTED" ]; then |
|
|
|
|
|
|
|
echo "$REFORMATTED" |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "$1" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
lookupnumberfromcallid() { |
|
|
|
lookupnumberfromcallid() { |
|
|
|
VOICECALLID=$1 |
|
|
|
VOICECALLID=$1 |
|
|
|
mmcli -m "$(modem_n)" --voice-list-calls -o "$VOICECALLID" -K | |
|
|
|
mmcli -m "$(modem_n)" --voice-list-calls -o "$VOICECALLID" -K | |
|
|
@ -47,16 +62,15 @@ lookupcontactname() { |
|
|
|
if [ "$1" = "--" ]; then |
|
|
|
if [ "$1" = "--" ]; then |
|
|
|
echo "Unknown number" |
|
|
|
echo "Unknown number" |
|
|
|
else |
|
|
|
else |
|
|
|
NUMBER="$(echo "$1" | sed "s/^0\([0-9]\{9\}\)$/${DEFAULT_NUMBER_PREFIX:-0}\1/")" |
|
|
|
|
|
|
|
CONTACT=$(sxmo_contacts.sh --all | |
|
|
|
CONTACT=$(sxmo_contacts.sh --all | |
|
|
|
grep "^$NUMBER:" | |
|
|
|
grep "^$1:" | |
|
|
|
cut -d':' -f 2 | |
|
|
|
cut -d':' -f 2 | |
|
|
|
sed 's/^[ \t]*//;s/[ \t]*$//' #strip leading/trailing whitespace |
|
|
|
sed 's/^[ \t]*//;s/[ \t]*$//' #strip leading/trailing whitespace |
|
|
|
) |
|
|
|
) |
|
|
|
if [ -n "$CONTACT" ]; then |
|
|
|
if [ -n "$CONTACT" ]; then |
|
|
|
echo "$CONTACT" |
|
|
|
echo "$CONTACT" |
|
|
|
else |
|
|
|
else |
|
|
|
echo "Unknown ($NUMBER)" |
|
|
|
echo "Unknown ($1)" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
} |
|
|
|
} |
|
|
@ -70,6 +84,7 @@ checkforfinishedcalls() { |
|
|
|
cut -d'/' -f2 |
|
|
|
cut -d'/' -f2 |
|
|
|
); do |
|
|
|
); do |
|
|
|
FINISHEDNUMBER="$(lookupnumberfromcallid "$FINISHEDCALLID")" |
|
|
|
FINISHEDNUMBER="$(lookupnumberfromcallid "$FINISHEDCALLID")" |
|
|
|
|
|
|
|
FINISHEDNUMBER="$(cleanupnumber "$FINISHEDNUMBER")" |
|
|
|
mmcli -m "$(modem_n)" --voice-delete-call "$FINISHEDCALLID" |
|
|
|
mmcli -m "$(modem_n)" --voice-delete-call "$FINISHEDCALLID" |
|
|
|
|
|
|
|
|
|
|
|
rm -f "$CACHEDIR/${FINISHEDCALLID}.monitoredcall" |
|
|
|
rm -f "$CACHEDIR/${FINISHEDCALLID}.monitoredcall" |
|
|
@ -142,6 +157,7 @@ checkforincomingcalls() { |
|
|
|
# Determine the incoming phone number |
|
|
|
# Determine the incoming phone number |
|
|
|
echo "sxmo_modemmonitor: Incoming Call:">&2 |
|
|
|
echo "sxmo_modemmonitor: Incoming Call:">&2 |
|
|
|
INCOMINGNUMBER=$(lookupnumberfromcallid "$VOICECALLID") |
|
|
|
INCOMINGNUMBER=$(lookupnumberfromcallid "$VOICECALLID") |
|
|
|
|
|
|
|
INCOMINGNUMBER="$(cleanupnumber "$INCOMINGNUMBER")" |
|
|
|
CONTACTNAME=$(lookupcontactname "$INCOMINGNUMBER") |
|
|
|
CONTACTNAME=$(lookupcontactname "$INCOMINGNUMBER") |
|
|
|
|
|
|
|
|
|
|
|
xset dpms force on |
|
|
|
xset dpms force on |
|
|
@ -181,6 +197,7 @@ checkfornewtexts() { |
|
|
|
grep sms.content.number | |
|
|
|
grep sms.content.number | |
|
|
|
sed -E 's/^sms\.content\.number\s+:\s+//' |
|
|
|
sed -E 's/^sms\.content\.number\s+:\s+//' |
|
|
|
)" |
|
|
|
)" |
|
|
|
|
|
|
|
NUM="$(cleanupnumber "$NUM")" |
|
|
|
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+//')" |
|
|
|
|
|
|
|
|
|
|
|
mkdir -p "$LOGDIR/$NUM" |
|
|
|
mkdir -p "$LOGDIR/$NUM" |
|
|
|