Restarting pulseaudio after phone calls

Is there a way to do this from an app (not looking for store approval with this).

There’s a long standing pulseaudio bug that corrupts subsequent call recordings on the Xperia X but if pulseaudio is restarted it works fine on subsequent recordings as well.

I thought I could write a basic “daemon” to just sit there in a blocking loop waiting for a call to finish/event to happen, but I have no idea how to detect that. (NOTE: if root access is required, that’s fine too, I’m not aiming for a UI app).


An option for restarting pulseaudio in Sailfish Utilities would be fine, as it is presently available for network, GUI, fingerprint sensor, and so on.

Wouldn’t a restart of the home screen be enough?

With qCommand you can easily define a script with the necessary CLI input and pin it to the app drawer


If you didn’t have a look at Call recording succeeds only on first record (Xperia X only, AFAIK), then you probably should. There are some contributions from other OPs that might be relevant.
I have a desktop file (/usr/share/applications/kpa.desktop) where I have:

[Desktop Entry]
Name=Kill Pulseaudio
Exec=killall -15 pulseaudio

Beware, do not kill too fast too often.

You can run a script in the background which listens for dbus events (no root required, no battery drain) and performs actions. The following will restart pulseaudio after a call is disconnected:

/usr/bin/dbus-monitor "type=signal, interface=org.nemomobile.voicecall.VoiceCall, path=/calls/active, member=statusChanged" |
    while read -r line; do
        if echo "${line}" | grep -q "string \"disconnected\""; then
            killall -15 pulseaudio # systemctl --user restart pulseaudio

Two thoughts: that’s a big gun but apparently necessary, and my paranoid self would add sleep 2 && before the killall for extra breathing room…

is not present by default, is it? Just vaguely remembered …

No, I’m wrong. At least it’s present on my GS290.

/usr/bin/killall is a symlink to busybox, so it’s available by default.

I’d tried a similar option to fix call recordings in xperia 10 II: mic stops working when a outgoing call is:

Unfortunately this bug in Xperia 10 II isn’t fixed with restarting pulseaudio service.

You can use Situations app to run a script when ending a call.

1 Like

This doesn’t seem to work. It never registers anything from the dbus-monitor. I’m guessing permissions/isolation level problem, or perhaps the event names don’t match up anymore.