Fix remaining issue with states cause of dangling event files

We also have to remove them on outgoing call. We use find instead of rm
with a wildcard cause wildcard look not expanded here.

Signed-off-by: Stacy Harper <contact@stacyharper.net>
Signed-off-by: Maarten van Gompel <proycon@anaproy.nl>
master
Stacy Harper 3 years ago committed by Maarten van Gompel
parent 25913ebaf1
commit 61a138a153
  1. 5
      scripts/modem/sxmo_modemdial.sh
  2. 2
      scripts/modem/sxmo_modemmonitor.sh

@ -1,6 +1,10 @@
#!/usr/bin/env sh #!/usr/bin/env sh
trap "gracefulexit" INT TERM trap "gracefulexit" INT TERM
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. "$(dirname "$0")/sxmo_common.sh"
fatalerr() { fatalerr() {
# E.g. hangup all calls, switch back to default audio, notify user, and die # E.g. hangup all calls, switch back to default audio, notify user, and die
mmcli -m "$(mmcli -L | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2)" --voice-hangup-all mmcli -m "$(mmcli -L | grep -oE 'Modem\/([0-9]+)' | cut -d'/' -f2)" --voice-hangup-all
@ -49,6 +53,7 @@ dialmenu() {
grep -Eo "Call/[0-9]+" | grep -Eo "Call/[0-9]+" |
grep -oE "[0-9]+" grep -oE "[0-9]+"
)" )"
find "$CACHEDIR" -name "$CALLID.*" -delete # we cleanup all dangling event files
echo "Starting call with CALLID: $CALLID" >&2 echo "Starting call with CALLID: $CALLID" >&2
echo "$CALLID" echo "$CALLID"
} }

@ -150,7 +150,7 @@ checkforincomingcalls() {
[ -z "$VOICECALLID" ] && return [ -z "$VOICECALLID" ] && return
[ -f "$CACHEDIR/${VOICECALLID}.monitoredcall" ] && return # prevent multiple rings [ -f "$CACHEDIR/${VOICECALLID}.monitoredcall" ] && return # prevent multiple rings
rm -f "$CACHEDIR/${VOICECALLID}.*" # we cleanup all dangling event files find "$CACHEDIR" -name "$VOICECALLID.*" -delete # we cleanup all dangling event files
touch "$CACHEDIR/${VOICECALLID}.monitoredcall" #this signals that we handled the call touch "$CACHEDIR/${VOICECALLID}.monitoredcall" #this signals that we handled the call
cat "$LASTSTATE" > "$CACHEDIR/${VOICECALLID}.laststate" cat "$LASTSTATE" > "$CACHEDIR/${VOICECALLID}.laststate"

Loading…
Cancel
Save