From d4fd25e3e9f1602f2a5112bfbeb9ee6a5443bbdc Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Sun, 25 Jul 2021 10:35:59 +0200 Subject: [PATCH] Prevent some error states cause of dangling event files Some event file stay present in some case (ex: .initiated) and this can lead to issues in futures calls. We remove dedicated cleanup and now we remove all event file related to the finish call in once. We do it in incoming call cause sometime modemnager fail to detect terminated calls. Signed-off-by: Stacy Harper Signed-off-by: Maarten van Gompel --- scripts/modem/sxmo_modemmonitor.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/scripts/modem/sxmo_modemmonitor.sh b/scripts/modem/sxmo_modemmonitor.sh index f2b63b3..884f4e1 100755 --- a/scripts/modem/sxmo_modemmonitor.sh +++ b/scripts/modem/sxmo_modemmonitor.sh @@ -95,29 +95,24 @@ checkforfinishedcalls() { if [ -f "$CACHEDIR/${FINISHEDCALLID}.discardedcall" ]; then #this call was discarded 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 echo "sxmo_modemmonitor: Finished call from $FINISHEDNUMBER">&2 - rm -f "$CACHEDIR/${FINISHEDCALLID}.pickedupcall" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" elif [ -f "$CACHEDIR/${FINISHEDCALLID}.hangedupcall" ]; then #this call was hung up by the user echo "sxmo_modemmonitor: Finished call from $FINISHEDNUMBER">&2 - rm -f "$CACHEDIR/${FINISHEDCALLID}.hangedupcall" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" elif [ -f "$CACHEDIR/${FINISHEDCALLID}.initiatedcall" ]; then #this call was hung up by the contact pkill -f sxmo_modemcall.sh echo "sxmo_modemmonitor: Finished call from $FINISHEDNUMBER">&2 - rm -f "$CACHEDIR/${FINISHEDCALLID}.initiatedcall" printf %b "$TIME\tcall_finished\t$FINISHEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" elif [ -f "$CACHEDIR/${FINISHEDCALLID}.mutedring" ]; then #this ring was muted up echo "sxmo_modemmonitor: Muted ring from $FINISHEDNUMBER">&2 - rm -f "$CACHEDIR/${FINISHEDCALLID}.mutedring" printf %b "$TIME\tring_muted\t$FINISHEDNUMBER\n" >> "$LOGDIR/modemlog.tsv" else #this is a missed call @@ -155,6 +150,7 @@ checkforincomingcalls() { [ -z "$VOICECALLID" ] && return [ -f "$CACHEDIR/${VOICECALLID}.monitoredcall" ] && return # prevent multiple rings + rm -f "$CACHEDIR/${VOICECALLID}.*" # we cleanup all dangling event files touch "$CACHEDIR/${VOICECALLID}.monitoredcall" #this signals that we handled the call cat "$LASTSTATE" > "$CACHEDIR/${VOICECALLID}.laststate"