Call improvements; fix bugs associated with hanging up; refresh bar on callend

master
Miles Alan 4 years ago
parent f88b83fd15
commit 91d6ebb15d
  1. 24
      scripts/modem/sxmo_modemcall.sh
  2. 2
      scripts/modem/sxmo_modemlog.sh
  3. 2
      scripts/modem/sxmo_modemtext.sh

@ -4,10 +4,11 @@ trap "gracefulexit" INT TERM
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
sxmo_vibratepine 1000 sxmo_vibratepine 1000 &
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
alsactl --file /usr/share/sxmo/default_alsa_sound.conf restore alsactl --file /usr/share/sxmo/default_alsa_sound.conf restore
notify-send "$1" notify-send "$1"
(sleep 0.5; echo 1 > /tmp/sxmo_bar) &
kill -9 0 kill -9 0
} }
@ -69,7 +70,6 @@ toggleflagset() {
FLAGS="$(toggleflag "$1" "$FLAGS")" FLAGS="$(toggleflag "$1" "$FLAGS")"
} }
dialmenu() { dialmenu() {
CONTACTS="$(contacts)" CONTACTS="$(contacts)"
NUMBER="$( NUMBER="$(
@ -112,7 +112,7 @@ hangup() {
CALLID="$1" CALLID="$1"
modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --hangup modem_cmd_errcheck -m "$(modem_n)" -o "$CALLID" --hangup
log_event "call_hangup" "$CALLID" log_event "call_hangup" "$CALLID"
fatalerr "Call hungup ok" fatalerr "Call with $NUMBER terminated"
exit 1 exit 1
} }
@ -144,7 +144,7 @@ incallmonitor() {
while true; do while true; do
echo 1 > /tmp/sxmo_bar echo 1 > /tmp/sxmo_bar
if mmcli -m "$(modem_n)" -K -o "$CALLID" | grep -E "^call.properties.state.+terminated"; then if mmcli -m "$(modem_n)" -K -o "$CALLID" | grep -E "^call.properties.state.+terminated"; then
fatalerr "$NUMBER hung up the call" fatalerr "Call with $NUMBER terminated"
fi fi
echo "Call still in progress" echo "Call still in progress"
sleep 3 sleep 3
@ -152,18 +152,20 @@ incallmonitor() {
} }
incallmenuloop() { incallmenuloop() {
echo "Current flags are $FLAGS"
CHOICES=" CHOICES="
$([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify
$([ "$WINDOWIFIED" = 0 ] && echo 'Screenlock ^ togglewindowify; sxmo_screenlock &')
Volume ↑ ^ sxmo_vol.sh up Volume ↑ ^ sxmo_vol.sh up
Volume ↓ ^ sxmo_vol.sh down Volume ↓ ^ sxmo_vol.sh down
Mic $(echo -- "$FLAGS" | grep -q -- -m && echo) ^ toggleflagset -m
Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo) ^ toggleflagset -l
Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo) ^ toggleflagset -z
Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo) ^ toggleflagset -e Earpiece $(echo -- "$FLAGS" | grep -q -- -e && echo) ^ toggleflagset -e
Mic $(echo -- "$FLAGS" | grep -q -- -m && echo) ^ toggleflagset -m
Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo) ^ toggleflagset -h Linejack $(echo -- "$FLAGS" | grep -q -- -h && echo) ^ toggleflagset -h
Linemic $(echo -- "$FLAGS" | grep -q -- -l && echo) ^ toggleflagset -l
Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo) ^ toggleflagset -s Speakerphone $(echo -- "$FLAGS" | grep -q -- -s && echo) ^ toggleflagset -s
Echomic $(echo -- "$FLAGS" | grep -q -- -z && echo) ^ toggleflagset -z
DTMF Tones ^ dtmfmenu $CALLID DTMF Tones ^ dtmfmenu $CALLID
Hangup ^ hangup $CALLID Hangup ^ hangup $CALLID
$([ "$WINDOWIFIED" = 0 ] && echo Windowify || echo Unwindowify) ^ togglewindowify
" "
echo "$CHOICES" | echo "$CHOICES" |
xargs -0 echo | xargs -0 echo |
@ -173,9 +175,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" | grep -Ev "." && fatalerr "$NUMBER hung up the call" echo "Picked is $PICKED"
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"
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
@ -189,7 +193,7 @@ dtmfmenu() {
while true; do while true; do
PICKED="$( PICKED="$(
echo "$NUMS" | grep -o . | sed '1 iReturn to Call Menu' | echo "$NUMS" | grep -o . | sed '1 iReturn to Call Menu' |
dmenu -l 20 -fn Terminus-20 -c -idx $DTMFINDEX -p "DTMF Tone" dmenu "$([ "$WINDOWIFIED" = 0 ] && echo "-c" || echo "-wm")" -l 20 -fn Terminus-20 -c -idx $DTMFINDEX -p "DTMF Tone"
)" )"
echo "$PICKED" | grep "Return to Call Menu" && return echo "$PICKED" | grep "Return to Call Menu" && return
DTMFINDEX=$(echo "$NUMS" | grep -bo "$PICKED" | cut -d: -f1 | xargs -IN echo 2+N | bc) DTMFINDEX=$(echo "$NUMS" | grep -bo "$PICKED" | cut -d: -f1 | xargs -IN echo 2+N | bc)

@ -1,3 +1,3 @@
#!/usr/bin/env sh #!/usr/bin/env sh
LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem LOGDIR="$XDG_CONFIG_HOME"/sxmo/modem
st -f "Terminus-14" -e tail -f "$LOGDIR"/modemlog.tsv st -f "Terminus-14" -e tail -n9999 -f "$LOGDIR"/modemlog.tsv

@ -76,7 +76,7 @@ sendtextmenu() {
} }
tailtextlog() { tailtextlog() {
st -e tail -f "$LOGDIR/$1/sms.txt" st -e tail -n9999 -f "$LOGDIR/$1/sms.txt"
} }
main() { main() {

Loading…
Cancel
Save