Asterisk; Stream Music on Hold

Recently I moved my Asterisk to a new server that provided unmetered bandwidth. I figured I would stream my hold music from some source on the internet instead of playing the same mp3 or two over and over. I searched google, and of course all the pages I found were from 2006.

As usual, I figured it out on my own. Today, in 2009. My findings are below.

First, find yourself a radio station to stream, I suggest perusing http://www.shoutcast.com/ for a list. In order for the method I outline below to work, the radio station needs to be "winamp" style. Meaning your music url looks like:

http://216.155.137.148:8004 OR
http://208.92.52.66:80/WVMVFMDIALUPCMP3

If its a media player style, and looks like:
http://208.85.242.70:80/ra45?MSWMExt=.asf
This method will not work, which is tragic because I really wanted to stream OZ.FM from Newfoundland, but its ASX.

Next, you need to install some libraries:
libid3tag-0.15.1b
libmad-0.15.1b
madplay-0.15.2b

You can get them from sourceforage, or google will tell you where to find them. Donwload, untar/gz, ./configure, make, make install.. you know the drill.

Now you need to edit your musiconhold.conf as follows:


Then create a file in /tmp/ (or wherever you want to, just update the above lines too if you don't use /tmp) called music.sh

Your path to bash may differ, as well as paths to wget and madplay. Use locate or which to find them.
The obvious URL above is the station I've chosen, be sure you change it to the station you have selected.

You should be all set, create yourself an extension to test it out.

Dial 711, and enjoy the music.

Back to Code Help | Moo! Networks

For the search engines: Asterisk, hold music, music on hold, stream hold music, hold music straming, musiconhold.conf, madplay, wget, unix, trixbox, pbx help, asterisk help, asterisk hold music, stream hold music asterisk, asterisk default hold music