@ -95,29 +95,24 @@ checkforfinishedcalls() {
if [ -f " $CACHEDIR / ${ FINISHEDCALLID } .discardedcall " ] ; then
if [ -f " $CACHEDIR / ${ FINISHEDCALLID } .discardedcall " ] ; then
#this call was discarded
#this call was discarded
echo " sxmo_modemmonitor: Discarded call from $FINISHEDNUMBER " >& 2
echo " sxmo_modemmonitor: Discarded call from $FINISHEDNUMBER " >& 2
rm -f " $CACHEDIR / ${ FINISHEDCALLID } .discardedcall "
printf %b " $TIME \tcall_discarded\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
printf %b " $TIME \tcall_discarded\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .pickedupcall " ] ; then
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .pickedupcall " ] ; then
#this call was picked up
#this call was picked up
pkill -f sxmo_modemcall.sh
pkill -f sxmo_modemcall.sh
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
rm -f " $CACHEDIR / ${ FINISHEDCALLID } .pickedupcall "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .hangedupcall " ] ; then
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .hangedupcall " ] ; then
#this call was hung up by the user
#this call was hung up by the user
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
rm -f " $CACHEDIR / ${ FINISHEDCALLID } .hangedupcall "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .initiatedcall " ] ; then
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .initiatedcall " ] ; then
#this call was hung up by the contact
#this call was hung up by the contact
pkill -f sxmo_modemcall.sh
pkill -f sxmo_modemcall.sh
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
echo " sxmo_modemmonitor: Finished call from $FINISHEDNUMBER " >& 2
rm -f " $CACHEDIR / ${ FINISHEDCALLID } .initiatedcall "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
printf %b " $TIME \tcall_finished\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .mutedring " ] ; then
elif [ -f " $CACHEDIR / ${ FINISHEDCALLID } .mutedring " ] ; then
#this ring was muted up
#this ring was muted up
echo " sxmo_modemmonitor: Muted ring from $FINISHEDNUMBER " >& 2
echo " sxmo_modemmonitor: Muted ring from $FINISHEDNUMBER " >& 2
rm -f " $CACHEDIR / ${ FINISHEDCALLID } .mutedring "
printf %b " $TIME \tring_muted\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
printf %b " $TIME \tring_muted\t $FINISHEDNUMBER \n " >> " $LOGDIR /modemlog.tsv "
else
else
#this is a missed call
#this is a missed call
@ -155,6 +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
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 "