Callaudiod does not set Speaker back on after phone call
I'm using sxmo, pmos edge, and a pinephone. I can reliably reproduce the following problems.
- After a phone call, the active out port will (almost always) remain Earpiece (as opposed to Speaker), as viewed in pavucontrol.
- After a phone call, the mic will (sometimes) remain unmuted (as viewed in pavucontrol)
- During a phone call, the out port will (sometimes) be both Earpiece and Speaker.
Our code in sxmo does the following:
When you receive a phone call, we call callaudiocli -m 1. When phone call ends, we call callaudiocli -m 0.
After some trial and error to fix the above, I had to do the following (see https://lists.sr.ht/~mil/sxmo-devel/patches/35419):
When you receive a phone call, call callaudiocli -m 1 AND ALSO:
default_sink="$(pamixer --get-default-sink | tail -n 1 | cut -d' ' -f1)"
pactl set-sink-port "$default_sink" "[Out] Earpiece" # make Earpiece out
pamixer -t --default-source --get-mute # toggle mic mute off
(Note: I tried also adding callaudiocli -s 0 and -u 1 but these had no effect.)
When you end phone call, call callaudiocli -m 0 AND ALSO:
sleep 1s # this is needed!
default_sink="$(pamixer --get-default-sink | tail -n 1 | cut -d' ' -f1)"
pactl set-sink-port "$default_sink" "[Out] Speaker" # make Speaker out
pamixer -t --default-source --get-mute # toggle mic mute on
(Note: I tried also adding callaudiocli -s 1 and -u 0 but these had no effect.)
Edited by peterjohnhartman