By default, in Ubuntu and probably other Linux distributions, if you're playing music in Rhythmbox, Audacious and so on while receiving a call in applications such as Skype, Ekiga Softphone, SFLphone VoIP Client and other VoIP applications, the music continues to play even after answering the call. PulseAudio has a feature that allows pausing or muting the music when receiving a call, but it's not enabled by default, at least in Ubuntu, so here's how to enable it.

To be able to use this PulseAudio feature, you need to enable two PulseAudio modules (one is already enabled in Ubuntu): "module-role-cork" and "module-augment-properties" and for applications that don't support this by default, to add a media.role to the application desktop file. Rhythmbox, Banshee and Skype (probably other applications too) already have this build-in so for them, you only need to load the PulseAudio modules I was talking about earlier (see below).





Here's the behavior you should expect after using the instructions below:

for some applications that have this feature built-in, the music player (Rhythmbox, Banshee) will pause the music when answering a call on Skype, SFLphone, etc.;

some applications that have this feature build-in will mute the sound when answering a call on a VoIP applications. Example of such an app: Totem (Videos);

for applications that don't support this by default, like Audacious and Linphone for instance, the music will be muted when answering a phone call.





Please note that this doesn't currently work with web browsers so if you're watching a video on YouTube in Firefox, Chrome, etc., the video won't be paused or muted when receiving a call.

PulseAudio: automatically mute music when answering calls in Skype, other VoIP apps

The instructions below have been tested in Ubuntu, but they should work in other Linux distributions as well, that's why I've added generic instructions too.

1.a. Ubuntu: firstly, let's load the "module-role-cork" PulseAudio module ("module-augment-properties" is already enabled by default in Ubuntu):

pactl load-module module-role-cork

pactl load-module module-cork-music-on-phone

sudo -H gedit /etc/pulse/default.pa

(I've used "sudo" instead of "gksu" because "gksu" is no longer available by default in Ubuntu 13.04 and it seems the developers want to stop supporting it anyway)

pactl load-module module-role-cork pactl load-module module-augment-properties

The first one might be called "module-cork-music-on-phone" on older PulseAudio versions so you may want to try that too if PulseAudio is older than 2.1. If you get an error when running the commands above, it may mean that the module was already loaded.

sudo -H gedit /etc/pulse/default.pa

Ubuntu and other Linux distributions: for Skype, SFLphone, Rhythmbox and Banshee (and probably other applications), that's all you have to do. Now when you answer a call, Banshee or Rhythmbox should be automatically paused.





2. Only for applications that don't support this by default, such as Audacious and Linphone: you need to edit the application desktop file (which you'll find in /usr/share/applications/) and add the following at the bottom of the file:

X-PulseAudio-Properties=media.role=music

X-PulseAudio-Properties=media.role=phone

sudo -H gedit /usr/share/applications/audacious.desktop

Basically, PulseAudio will mute any application with "media.role=music" when some other application with "media.role=phone" starts makes use of the sound (although when ringing, the music isn't muted until you answer the call, at least that's how it has worked in my test with Skype).



For video players (e.g.: VLC, which doesn't support this PulseAudio feature by default), you could add "media.role=video", but you can also simply stick with "media.role=music" since that will get the job done for any type of application or even games. See all the supported PulseAudio media roles,

(although when ringing, the music isn't muted until you answer the call, at least that's how it has worked in my test with Skype).For video players (e.g.: VLC, which doesn't support this PulseAudio feature by default), you could add "media.role=video", but you can also simply stick with "media.role=music" since that will get the job done for any type of application or even games. See all the supported PulseAudio media roles, HERE









via reddit One more thing: remember to start those applications from the desktop files (from Unity Dash, the menu, etc.) and not from the command line or else this won't work (except for applications which support this feature by default, like Rhythmbox or Banshee.

This will only load the module for this session and the changes will be lost after a system restart so let's make this permanent. To do this, openas root with a text editor - I'll use Gedit below:and:, search for "" and uncomment that line (to "uncomment" means to remove the "#" from the beginning of the line);or older, the module name is different so search for "" and uncomment this line (to "uncomment" means to remove the "#" from the beginning of the line).Then save the file.make sure both "module-role-cork" and "module-augment-properties" PulseAudio modules are loaded:Then, openas root with a text editor - I'll use Gedit for the command below:Then search for "" (if you can't find it, search for "" instead) and "" and uncomment both lines (to "uncomment" means to remove the "#" from the beginning of the line). And finally, save the file.- for music apps (example: Audacious):- for VoIP / SIP apps (example: Linphone):After making the changes, close the application and start it again from the menu / Dash.for Audacious, you need to edit thefile so open that file as root with a text editor - I'll use Gedit below:and at the bottom of this file, add "X-PulseAudio-Properties=media.role=music" (without the quotes), save the file, close Audacious and start it from the menu / Dash. Now, if Audacious is playing when receiving a call on Skype for instance, the music will be muted when answering the call.