Fix background call hangup and end calls on screen lock or lid close

This commit is contained in:
Luxferre committed 2026-11-04 17:59:19 +02:00
1 parent c7cdde6734
commit 0c352f0a10
55 files changed
+391 -120

No files matched your search

+21 -4
View File
@@ -2,6 +2,10 @@
# SPDX-License-Identifier: AGPL-3.0-only
# Copyright 2022 Sxmo Contributors
export HOME="${HOME:-/home/user}"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/10000}"
export PATH="${XDG_CONFIG_HOME:-$HOME/.config}/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin:$PATH"
# include common definitions
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
. sxmo_hook_icons.sh
@@ -127,13 +131,23 @@ pickup() {
}
hangup() {
CALLID="$1"
CALLID="${1:-all}"
case "$CALLID" in
""|"-"|"all")
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/"* /tmp/sxmo_call_ringing /tmp/sxmo_active_call 2>/dev/null || true
mmcli -m any --voice-hangup-all >/dev/null 2>&1 || true
doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || \
/usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || true
doas -n dbus-send --system --type=signal / org.ofono.VoiceCallManager.CallRemoved >/dev/null 2>&1 || true
sxmo_hook_hangup.sh || true
return 0
;;
sub1_*|sub0_*)
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}."* 2>/dev/null || true
rm -f "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}."* "$XDG_RUNTIME_DIR/sxmo_calls/sub1_dialing."* /tmp/sxmo_call_ringing /tmp/sxmo_active_call 2>/dev/null || true
doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 || \
/usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 || true
/usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 || \
doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1 || true
doas -n dbus-send --system --type=signal / org.ofono.VoiceCallManager.CallRemoved >/dev/null 2>&1 || true
sxmo_hook_hangup.sh || true
return 0
@@ -155,10 +169,13 @@ hangup() {
# this call was never picked up and hung up immediately, so it is a discarded call
touch "$XDG_RUNTIME_DIR/sxmo_calls/${CALLID}.discardedcall" || true
fi
rm -f /tmp/sxmo_call_ringing /tmp/sxmo_active_call 2>/dev/null || true
HANGUP_FAILED=0
if ! mmcli -m any -o "$CALLID" --hangup 2>/dev/null && \
! doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1; then
! mmcli -m any --voice-hangup-all 2>/dev/null && \
! doas -n /usr/libexec/msm-modem-uim-selection call-hangup "$CALLID" >/dev/null 2>&1 && \
! doas -n /usr/libexec/msm-modem-uim-selection call-hangup all >/dev/null 2>&1; then
# we ignore already closed calls
if list_active_calls | grep -q "/$CALLID "; then
HANGUP_FAILED=1