Missed call rework: Use dbus to check for missed calls & properly delete pickup

Use dbus to monitor for missed calls. Missed calls used to work but had a
regression due to the work to make text/calls used dbus. This adds the proper
dbus hook for missed calls as well and also changes the incoming call
notification to allow for multiple incoming calls (theoretically).

Tested for a single caller and transitioning the pickup notification
into a missed call notification and all is working good.
master
Miles Alan 4 years ago committed by Maarten van Gompel
parent 8abe870012
commit f2fc6a406e
  1. 20
      scripts/modem/sxmo_modemmonitor.sh
  2. 3
      scripts/modem/sxmo_modemmonitortoggle.sh

@ -41,6 +41,8 @@ checkformissedcalls() {
); do
MISSEDNUMBER="$(lookupnumberfromcallid "$MISSEDCALLID")"
mmcli -m "$(modem_n)" --voice-delete-call "$MISSEDCALLID"
rm -f "$NOTIFDIR/incomingcall_${MISSEDCALLID}_notification"
TIME="$(date --iso-8601=seconds)"
mkdir -p "$LOGDIR"
@ -62,7 +64,6 @@ checkforincomingcalls() {
grep -Eo '[0-9]+ incoming \(ringing-in\)' |
grep -Eo '[0-9]+'
)"
echo "$VOICECALLID" | grep -v . && rm -f "$NOTIFDIR/incomingcall" && return
# Determine the incoming phone number
echo "Incoming Call:"
@ -79,7 +80,7 @@ checkforincomingcalls() {
printf %b "$TIME\tcall_ring\t$INCOMINGNUMBER\n" >> "$LOGDIR/modemlog.tsv"
sxmo_notificationwrite.sh \
"$NOTIFDIR/incomingcall" \
"$NOTIFDIR/incomingcall_${VOICECALLID}_notification" \
"sxmo_modemcall.sh pickup $VOICECALLID" \
none \
"Pickup - $(sxmo_contacts.sh | grep -E "^\\$INCOMINGNUMBER")" &
@ -125,15 +126,28 @@ checkfornewtexts() {
mainloop() {
checkformissedcalls
checkforincomingcalls
checkfornewtexts
# Monitor for incoming calls
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Voice',type='signal',member='CallAdded'" | \
while read -r; do
checkforincomingcalls
checkformissedcalls
done &
# Monitor for incoming texts
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem.Messaging',type='signal',member='Added'" | \
while read -r; do
checkfornewtexts
done &
# Monitor for missed calls
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" | \
while read -r; do
checkformissedcalls
done &
wait
wait
wait
}

@ -5,7 +5,8 @@ else
sxmo_modemmonitor.sh &
fi
rm /tmp/sxmo_incomingcall
NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications
rm $NOTIFDIR/incomingcall*
# E.g. wait until process killed or started -- maybe there's a better way..
sleep 1

Loading…
Cancel
Save