Elastix 2.0.3 is a Linux distribution that contains Asterisk 1.6.2.13 (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 “ftp://ftp.sunet.se/pub/os/Linux/RPMForge/dag/redhat/el3/en/i386/RPMS.dag/mpg123-1.6.2-1.el3.rf.i386.rpm”
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:
- Open Firefox and browse to www.di.fm
- 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”.
Image may be NSFW.
Clik here to view. - Once the download has completed, right click on listen.pls and then click on “Open Containing Folder”.
Image may be NSFW.
Clik here to view. - Using your favorite text editor, mine is UltraEdit, open listen.pls and select the http:// stream for file1 and copy to your clipboard.
Image may be NSFW.
Clik here to view.
Configuring Elastix
Now that you have a stream URL ready for use, open your Elastix web interface and click on the PBX tab.
- Under PBX configuration, on the left side of the screen, click on the “Music on Hold” link from the Internal Options & Configuration section.
- Now click on the “Add Streaming Category” on the right side of the screen.
- In the Category Name field, enter whatever you wish, “DI-Chillout-Dreams”?
- 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:
- 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.
- 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.
-Aaron