Streaming Music on Hold in Elastix /Trixbox

Written by admin on November 22, 2014. Posted in Elastix, Trixbox

Sometimes you may want to stream a live radio channel on your Elastix server. The channel needs to be on shoutcast or icecast for this to work. You will make use of the musiconhold feature on  the Freepbx. Your stream must also be streamed as an MP3. I have not tried this with an AAC stream.

Since your stream is MP3 we will need to install mpg123. This however is not included in the Elastix installation so we will need to install it. In Trixbox find out if it is installed by running the command

# mpg123 –v

Then we perform installation (If its installed in Trixbox there is no need to install )

# cd /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 we install dependencies 

# yum install audiofile
# yum install glibc
# yum install libtool-ltdl
# yum install esound

Then run the installation of the rpm file

# rpm -ivh mpg123-1.6.2-1.el3.rf.i386.rpm

Configuration

You will need to get your stream url ready. The stream url is in the form http://176.9.164.202:8023 (this is my stream onhttp://www.netradiobroadcaster.net  You can get an account here if you want to own one. Use autodj to put your mp3 files which will be streamed.

Now that you have your URL 

1. Go to the unembedded FreePBX and click music on hold tab

2. Click Add stream category n

 

3. Create a category and in the Application field, enter the following, then paste the stream URL at the end of the application string (replacing [streamURL] )

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

 

You now need an inbound route i.e a DID to access the stream

You can get cheap DIDs from www.didinternational.net

Go to inbound route in freePBX settings

1. Create an inbound route with your DID number.

2. On the music on hold field replace Default with your new category you created above.

3. For destination use Terminate and in the next field put "Put caller on hold forever"

 

Thats it. Reload your asterisk and your stream should play well