This article explains how to add Music On Hold (or MOH) for Asterisk 10. The music will be streaming from the Internet – in this case, the “ABC News Radio” channel/station. Note that the download of Internet radio data starts when someone goes on hold. And stops when they go off hold. Also note that while testing, make sure you try a few times after each change because it takes a while to start streaming the first time (about 30 seconds).
Edit you “/etc/asterisk/musiconhold.conf” file to look like the following – or just add the “mode” and “application” lines to the [default] section:
[general] [default] ;AGIX - radio on hold mode=custom application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 [email protected] http://media.on.net/radio/155.m3u
Restart Asterisk to test your changes.
For troubleshooting, consider the following section from the “/etc/asterisk/extensions.conf” file. It states that when a call comes in, go direct to Music On Hold:
[incoming] ; incoming phone calls exten => s,1,Answer() exten => s,n,MusicOnHold(200)
Also check that you have “mpg123”. If not, install it using “yum install mpg123” on CentOS or Redhat.
You can add a different music station by browsing through “http://www.shoutcast.com”. When you find a good station, right click on it and choose to download the “.pls” file. Look inside that file for the “http” lines. Pick on and replace the example above with the line/URL that you want. Then restart Asterisk again.