|
|
@ -27,7 +27,7 @@ finish() { |
|
|
|
fi |
|
|
|
fi |
|
|
|
setsid -f sh -c 'sleep 2; sxmo_statusbarupdate.sh' |
|
|
|
setsid -f sh -c 'sleep 2; sxmo_statusbarupdate.sh' |
|
|
|
if [ -n "$1" ]; then |
|
|
|
if [ -n "$1" ]; then |
|
|
|
echo "$1">&2 |
|
|
|
echo "sxmo_modemcall: $1">&2 |
|
|
|
notify-send "$1" |
|
|
|
notify-send "$1" |
|
|
|
fi |
|
|
|
fi |
|
|
|
kill -9 0 |
|
|
|
kill -9 0 |
|
|
@ -43,7 +43,7 @@ gracefulexit() { |
|
|
|
modem_cmd_errcheck() { |
|
|
|
modem_cmd_errcheck() { |
|
|
|
RES="$(mmcli "$@" 2>&1)" |
|
|
|
RES="$(mmcli "$@" 2>&1)" |
|
|
|
OK="$?" |
|
|
|
OK="$?" |
|
|
|
echo "Command: mmcli $*">&2 |
|
|
|
echo "sxmo_modemcall: Command: mmcli $*">&2 |
|
|
|
if [ "$OK" != 0 ]; then finish "Problem executing mmcli command!\n$RES"; fi |
|
|
|
if [ "$OK" != 0 ]; then finish "Problem executing mmcli command!\n$RES"; fi |
|
|
|
echo "$RES" |
|
|
|
echo "$RES" |
|
|
|
} |
|
|
|
} |
|
|
@ -86,7 +86,7 @@ toggleflagset() { |
|
|
|
|
|
|
|
|
|
|
|
acceptcall() { |
|
|
|
acceptcall() { |
|
|
|
CALLID="$1" |
|
|
|
CALLID="$1" |
|
|
|
echo "Attempting to initialize CALLID $CALLID">&2 |
|
|
|
echo "sxmo_modemcall: Attempting to initialize CALLID $CALLID">&2 |
|
|
|
DIRECTION="$( |
|
|
|
DIRECTION="$( |
|
|
|
mmcli --voice-status -o "$CALLID" -K | |
|
|
|
mmcli --voice-status -o "$CALLID" -K | |
|
|
|
grep call.properties.direction | |
|
|
|
grep call.properties.direction | |
|
|
@ -96,17 +96,17 @@ acceptcall() { |
|
|
|
if [ "$DIRECTION" = "outgoing" ]; then |
|
|
|
if [ "$DIRECTION" = "outgoing" ]; then |
|
|
|
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --start |
|
|
|
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --start |
|
|
|
log_event "call_start" "$CALLID" |
|
|
|
log_event "call_start" "$CALLID" |
|
|
|
echo "Started call $CALLID">&2 |
|
|
|
echo "sxmo_modemcall: Started call $CALLID">&2 |
|
|
|
elif [ "$DIRECTION" = "incoming" ]; then |
|
|
|
elif [ "$DIRECTION" = "incoming" ]; then |
|
|
|
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/pickup" ]; then |
|
|
|
if [ -x "$XDG_CONFIG_HOME/sxmo/hooks/pickup" ]; then |
|
|
|
echo "Invoking pickup hook (async)">&2 |
|
|
|
echo "sxmo_modemcall: Invoking pickup hook (async)">&2 |
|
|
|
"$XDG_CONFIG_HOME/sxmo/hooks/pickup" & |
|
|
|
"$XDG_CONFIG_HOME/sxmo/hooks/pickup" & |
|
|
|
fi |
|
|
|
fi |
|
|
|
touch "$CACHEDIR/${CALLID}.pickedupcall" #this signals that we picked this call up |
|
|
|
touch "$CACHEDIR/${CALLID}.pickedupcall" #this signals that we picked this call up |
|
|
|
#to other asynchronously running processes |
|
|
|
#to other asynchronously running processes |
|
|
|
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --accept |
|
|
|
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --accept |
|
|
|
log_event "call_pickup" "$CALLID" |
|
|
|
log_event "call_pickup" "$CALLID" |
|
|
|
echo "Picked up call $CALLID">&2 |
|
|
|
echo "sxmo_modemcall: Picked up call $CALLID">&2 |
|
|
|
else |
|
|
|
else |
|
|
|
finish "Couldn't initialize call with callid <$CALLID>; unknown direction <$DIRECTION>" |
|
|
|
finish "Couldn't initialize call with callid <$CALLID>; unknown direction <$DIRECTION>" |
|
|
|
fi |
|
|
|
fi |
|
|
@ -157,13 +157,13 @@ incallmonitor() { |
|
|
|
finish "Call with $NUMBER terminated" |
|
|
|
finish "Call with $NUMBER terminated" |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
fi |
|
|
|
echo "Call still in progress">&2 |
|
|
|
echo "sxmo_modemcall: Call still in progress">&2 |
|
|
|
sleep 3 |
|
|
|
sleep 3 |
|
|
|
done |
|
|
|
done |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
incallmenuloop() { |
|
|
|
incallmenuloop() { |
|
|
|
echo "Current flags are $FLAGS">&2 |
|
|
|
echo "sxmo_modemcall: Current flags are $FLAGS">&2 |
|
|
|
CHOICES=" |
|
|
|
CHOICES=" |
|
|
|
$([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify |
|
|
|
$([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify |
|
|
|
$([ "$WINDOWIFIED" = 0 ] && echo 'Screenlock ^ togglewindowify; sxmo_screenlock &') |
|
|
|
$([ "$WINDOWIFIED" = 0 ] && echo 'Screenlock ^ togglewindowify; sxmo_screenlock &') |
|
|
@ -188,11 +188,11 @@ incallmenuloop() { |
|
|
|
dmenu -idx $DMENUIDX -l 14 "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -fn "Terminus-30" -p "$NUMBER" | |
|
|
|
dmenu -idx $DMENUIDX -l 14 "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -fn "Terminus-30" -p "$NUMBER" | |
|
|
|
( |
|
|
|
( |
|
|
|
PICKED="$(cat)"; |
|
|
|
PICKED="$(cat)"; |
|
|
|
echo "Picked is $PICKED">&2 |
|
|
|
echo "sxmo_modemcall: Picked is $PICKED">&2 |
|
|
|
echo "$PICKED" | grep -Ev "." |
|
|
|
echo "$PICKED" | grep -Ev "." |
|
|
|
CMD=$(echo "$CHOICES" | grep "$PICKED" | cut -d'^' -f2) |
|
|
|
CMD=$(echo "$CHOICES" | grep "$PICKED" | cut -d'^' -f2) |
|
|
|
DMENUIDX=$(echo "$(echo "$CHOICES" | grep -n "$PICKED" | cut -d ':' -f1)" - 1 | bc) |
|
|
|
DMENUIDX=$(echo "$(echo "$CHOICES" | grep -n "$PICKED" | cut -d ':' -f1)" - 1 | bc) |
|
|
|
echo "Eval in call context: $CMD">&2 |
|
|
|
echo "sxmo_modemcall: Eval in call context: $CMD">&2 |
|
|
|
eval "$CMD" |
|
|
|
eval "$CMD" |
|
|
|
incallmenuloop |
|
|
|
incallmenuloop |
|
|
|
) & wait # E.g. bg & wait to allow for SIGINT propogation |
|
|
|
) & wait # E.g. bg & wait to allow for SIGINT propogation |
|
|
|