Files
sxmo-utils/scripts/core/sxmo_keyboard.sh
Stacy Harper 73a2813d76 Rework calls
We need the recent -S (status) command to probe the real state of
callaudiod.

- Lot of cleanup and refactorisation

Most of the code has been moved to a better place. The call audio
setups, the pickup action and the incall menu now are three different
things we can call individually.

- Handle failures individually

Every important task as the mmcli command or volume settings should warn
a urgent message to the user if they failed.

If we failed to setup audio, or to pickup the call then we dont even try
to open the incall menu.

- Made the incall_menu closeable and re-opennable

You can close the incoming call menu and the incall menu and re-open
them from any menu.

To make this possible I moved some of the responsibilities to the
modem monitor that trigger action after modem manager signals. We then
check at this point if it was the last call and do some cleanup if so.

- Initial work for concurrent calls

Added some code to the hooks and the modem checkfinished and
checkincoming calls to handle those cased. If you are in a call and someone
else try to call you, we refresh the incall menu and new entries will allow
you to switch calls.

- The incall menu isnt sticked to one call

This menu itself doesnt need a CALLID argument. It allow us to
manage every active call. We should be able to hold and hangup and
switch calls as we want.
2022-03-25 21:29:30 +01:00

41 lines
769 B
Bash
Executable File

#!/bin/sh
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
# include common definitions
# shellcheck source=scripts/core/sxmo_common.sh
. sxmo_common.sh
isopen() {
if [ -z "$KEYBOARD" ]; then
exit 0 # ssh/tty usage by example
fi
pidof "$KEYBOARD" > /dev/null
}
open() {
if [ -n "$KEYBOARD" ]; then
#Note: KEYBOARD_ARGS is not quoted by design as it may includes a pipe and further tools
# shellcheck disable=SC2086
isopen || eval "$KEYBOARD" $KEYBOARD_ARGS &
fi
}
close() {
if [ -n "$KEYBOARD" ]; then # avoid killing everything !
pkill "$KEYBOARD"
fi
}
if [ "$1" = "toggle" ]; then
close || open
elif [ "$1" = "close" ]; then
if isopen; then
close
fi
elif [ "$1" = "isopen" ]; then
isopen || exit 1
else
open
fi