Added an option (extra notification) to discard an incoming call #157
This commit is contained in:
parent
24f8ed8478
commit
c58fa6a1e9
2 changed files with 18 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
LOGDIR="$XDG_DATA_HOME"/sxmo/modem
|
||||
NOTIFDIR="$XDG_DATA_HOME"/sxmo/notifications
|
||||
ALSASTATEFILE="$XDG_CACHE_HOME"/precall.alsa.state
|
||||
CACHEDIR="$XDG_CACHE_HOME"/sxmo
|
||||
trap "gracefulexit" INT TERM
|
||||
|
@ -86,6 +87,7 @@ toggleflagset() {
|
|||
|
||||
acceptcall() {
|
||||
CALLID="$1"
|
||||
rm "$NOTIFDIR/incomingcall_${CALLID}_notification"* 2>dev/null #there can be multiple actionable notifications for one call (pickup/discard)
|
||||
echo "sxmo_modemcall: Attempting to initialize CALLID $CALLID">&2
|
||||
DIRECTION="$(
|
||||
mmcli --voice-status -o "$CALLID" -K |
|
||||
|
@ -115,6 +117,11 @@ acceptcall() {
|
|||
|
||||
hangup() {
|
||||
CALLID="$1"
|
||||
rm "$NOTIFDIR/incomingcall_${CALLID}_notification"* 2>dev/null #there can be multiple actionable notifications for one call (pickup/discard)
|
||||
if [ ! -f "$CACHEDIR/${CALLID}.pickedupcall" ]; then
|
||||
#this call was never picked up and hung up immediately, so it is a discarded call
|
||||
touch "$CACHEDIR/${CALLID}.discardedcall" #this signals that we discarded this call to other asynchronously running processes
|
||||
fi
|
||||
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --hangup
|
||||
log_event "call_hangup" "$CALLID"
|
||||
modem_cmd_errcheck -m "$(modem_n)" --voice-delete-call="$CALLID"
|
||||
|
|
|
@ -70,11 +70,15 @@ checkforfinishedcalls() {
|
|||
); do
|
||||
FINISHEDNUMBER="$(lookupnumberfromcallid "$FINISHEDCALLID")"
|
||||
mmcli -m "$(modem_n)" --voice-delete-call "$FINISHEDCALLID"
|
||||
rm -f "$NOTIFDIR/incomingcall_${FINISHEDCALLID}_notification"
|
||||
rm -f "$NOTIFDIR/incomingcall_${FINISHEDCALLID}_notification"* #there may be multiple actionable notification for one call
|
||||
|
||||
TIME="$(date --iso-8601=seconds)"
|
||||
mkdir -p "$LOGDIR"
|
||||
if [ -f "$CACHEDIR/${FINISHEDCALLID}.pickedupcall" ]; then
|
||||
if [ -f "$CACHEDIR/${FINISHEDCALLID}.discardedcall" ]; then
|
||||
echo "sxmo_modemmonitor: Discarded call from $FINISHEDNUMBER">&2
|
||||
rm -f "$CACHEDIR/${FINISHEDCALLID}.discardedcall"
|
||||
printf %b "$TIME\tcall_discarded\t$FINISHEDNUMBER\n" >> "$LOGDIR/modemlog.tsv"
|
||||
elif [ -f "$CACHEDIR/${FINISHEDCALLID}.pickedupcall" ]; then
|
||||
#this call was picked up
|
||||
pkill -f sxmo_modemcall.sh #kill call (softly) in case it is still in progress (remote party hung up)
|
||||
echo "sxmo_modemmonitor: Finished call from $FINISHEDNUMBER">&2
|
||||
|
@ -125,6 +129,11 @@ checkforincomingcalls() {
|
|||
"sxmo_modemcall.sh pickup $VOICECALLID" \
|
||||
none \
|
||||
"Pickup - $CONTACTNAME" &
|
||||
sxmo_notificationwrite.sh \
|
||||
"$NOTIFDIR/incomingcall_${VOICECALLID}_notification_discard" \
|
||||
"sxmo_modemcall.sh hangup $VOICECALLID" \
|
||||
none \
|
||||
"Discard - $CONTACTNAME" &
|
||||
|
||||
echo "sxmo_modemmonitor: Call from number: $INCOMINGNUMBER (VOICECALLID: $VOICECALLID)">&2
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue