Streaming Music on Hold in Elastix 2.0

Elastix 2.0.3 is a Linux distribution that contains Asterisk (as of the writing of this article) and other Asterisk centric addons, such as the Elastix web interface, Hylafax and Flash Operator Panel. Arguably, Elastix is the best Asterisk package available today and is an enterprise ready implementation of the Asterisk phone system software. Enough about my experience-driven opinion on Elastix and Asterisk, let’s talk about Streaming some Music on Hold!

Ensuring Streaming Capability

The first step is to ensure that we have the appropriate application for playing our music on hold stream. Because we will be using an MP3 stream, we will want to use mpg123. Unfortunately, the mpg123 application is not included in the Elastix distribution, so, let’s install it. We will also need to install other components/applications associated with mpg123:

Let’s start by downloading the RPM package for mpg123:

[root@server /]# cd /usr/src
[root@server /usr/src]# wget “”

Next, well install the required applications to make mpg123 work (if you don’t want to explicitly run these, skip to installing the rpm and install the required application as you are requested):

[root@server /usr/src]# yum install audiofile
[root@server /usr/src]# yum install glibc
[root@server /usr/src]# yum install libtool-ltdl
[root@server /usr/src]# yum install esound

Finally, lets install mpg123:

[root@server /usr/src]# rpm -ivh mpg123-1.6.2-1.el3.rf.i386.rpm

Acquiring a Stream

The second step in configuring streaming music on hold is finding the stream you want to use. For this example, I will use a Digitally Imported stream named Chillout Dreams.

Because of the way that Firefox handles downloads, I’m going to demonstrate accessing the stream file using Firefox:

  1. Open Firefox and browse to
  2. Using the mouse, hover over the DI menu “Listen Now!”, then hover over “Chillout Dreams”, then hover over “MP3 Streams”, and finally click on “96k Cable/DSL”.
  3. Once the download has completed, right click on listen.pls and then click on “Open Containing Folder”.
  4. Using your favorite text editor, mine is UltraEdit, open listen.pls and select the http:// stream for file1 and copy to your clipboard.

Configuring Elastix

Now that you have a stream URL ready for use, open your Elastix web interface and click on the PBX tab.

  1. Under PBX configuration, on the left side of the screen, click on the “Music on Hold” link from the Internal Options & Configuration section.
  2. Now click on the “Add Streaming Category” on the right side of the screen.
  3. In the Category Name field, enter whatever you wish, “DI-Chillout-Dreams”?
  4. In the Application field, enter the following, then paste the stream URL at the end of the application string (replacing [streamURL] of course):

/usr/bin/mpg123 -q -s –mono -r 8000 -f 8192 -b 0 [streamURL]

Now that you have the Music on Hold defined, we need to configure your inbound and outbound routes to use the music on hold:

  1. Click on the “Outbound Routes” and then click on your route(s), then in the drop down list for “Music on Hold?”, choose your new music on hold category.
  2. Click on the “Inbound Routes” and then click on your route(s), then in the drop down list for “Music on Hold?”, choose your new music on hold category.

On the Back End

When  you created the music on hold category/application, the Asterisk file modified is /etc/asterisk/musiconhold_additional.conf, which is included in the base music on hold file /etc/asterisk/musiconhold.conf.

If you open the conf file in a text editor, you’ll notice the category/application that you added earlier.


About aaron

IT is not just a job but also a passion. Everything I have accomplished, both personally and professionally, has been generally entertaining, bordering on fun. Some of my projects, such as working with SharePoint Services workflow actions in Visual Studio or building a custom iSCSI SAN using the OpenSolaris, ZFS and COMSTAR, has been quite rewarding. You may think nerd...I think developing a new trend!