Ubuntu / Linux news and application reviews.

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.

skype call audacious muted


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):

- for Ubuntu 12.10, 13.04 and newer:
pactl load-module module-role-cork
- for Ubuntu 12.04 or older:
pactl load-module module-cork-music-on-phone

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, open /etc/pulse/default.pa as root with a text editor - I'll use Gedit below:
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)

and:
- for Ubuntu 12.10, 13.04 or newer, search for "load-module module-role-cork" and uncomment that line (to "uncomment" means to remove the "#" from the beginning of the line);
- for Ubuntu 12.04 or older, the module name is different so search for "load-module module-cork-music-on-phone" and uncomment this line (to "uncomment" means to remove the "#" from the beginning of the line).

Then save the file.

1.b. For other Linux distributions: make sure both "module-role-cork" and "module-augment-properties" PulseAudio modules are loaded:
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.

Then, open /etc/pulse/default.pa as root with a text editor - I'll use Gedit for the command below:
sudo -H gedit /etc/pulse/default.pa

Then search for "load-module module-role-cork" (if you can't find it, search for "load-module module-cork-music-on-phone" instead) and "load-module module-augment-properties" and uncomment both lines (to "uncomment" means to remove the "#" from the beginning of the line). And finally, save the file.


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:

- for music apps (example: Audacious):
X-PulseAudio-Properties=media.role=music
- for VoIP / SIP apps (example: Linphone):
X-PulseAudio-Properties=media.role=phone
After making the changes, close the application and start it again from the menu / Dash.

Example: for Audacious, you need to edit the /usr/share/applications/audacious.desktop file so open that file as root with a text editor - I'll use Gedit below:
sudo -H gedit /usr/share/applications/audacious.desktop
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.

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, HERE.

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.