HOWTO: Streaming Music On Hold on TrixBox.
These instructions are borrowed from Alan at ServerPacket.com
(http://community.serverpacket.com/showthread.php?p=22). I just wanted to show how to get the URL from a live stream on Real Player and Window Media Player so that you can use your favorite station on Trixbox by following this guide.
PLEASE: USE THIS GUIDE AT YOUR OWN RISK, I DON'T KNOW THE LEGAL SIDE OF STREAMING MUSIC, SPECIALLY COPYRIGHTED MATERIAL. DO YOUR RESEARCH.
The first thing you have to do is find out if you have mpg123 player installed on your system, we need version 0.59r or later installed.
In command prompt type the following, if the player is installed the return will show you the version you are running on top of the result.
mpg123 –v
If the player is not installed, or you have an older version download and install version 0.59r by typing the following in command prompt, one line at the time.
cd /usr/bin wget <a href="http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz" title="http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz">http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz</a> tar –zxvf mpg123-0.59r.tar.gz cd mpg123-0.59r make linux make install ln -s /usr/local/bin/mpg123 /usr/bin/mpg123
Now you need to make a directory for the streaming music, do the following:
cd /var/lib/asterisk/mohmp3/ mkdir stream
Make a zero length dummy mp3 file inside of the stream directory, do:
cd stream touch stream.mp3
Edit the musiconhold.conf file.
Musiconhold.conf is where you add your music code! You will need to have the URL of the radio station you want to play, I will show you how to get it (which is the part most guides don’t tell you). Like I mentioned in the beginning, I have been using my streaming music from www.shoutcast.com, the guy who wrote this, Alan uses www.radioio.com. It is up to you, personally I like shoutcast because of their big selection. You can change your radio station streaming everyday if you want to.
Go to shoutcast and find the station you like by clicking on the tune in button. You need to have RealPlayer to play most of their music, once the music starts playing go to File >clip properties >View Clip Info or you can do a Ctrl+I. Write down the filename which should look like this: http://62.75.220.137:9006 (this is the URL we need).
If you get to a station that uses Windows Media Player, the URL can be found by going to: File>Properties; location is what you want.
Okay, time to add our streaming stations to the musiconhold.conf file, do the following to open and edit the file.
nano -w /etc/asterisk/musiconhold.conf
On the very top of the file enter the following command; just replace the URL with the one of the radio station you want to use.
Leave everything else unchanged, so that your file looks like the following: Default =>...quiet has to one line.
[classes] default =>quietmp3:/var/lib/asterisk/mohmp3/stream,http://64.202.98.180:80/ [moh_files] default => /var/lib/asterisk/mohmp3,r #include musiconhold_additional.conf ; class definition for Streaming MOH ;stream => quietmp3:/var/lib/asterisk/mohmp3/stream ; class definitions For A2Billing acc_1 => mp3:/var/lib/asterisk/mohmp3/acc_1 acc_2 => mp3:/var/lib/asterisk/mohmp3/acc_2 acc_3 => mp3:/var/lib/asterisk/mohmp3/acc_3 acc_4 => mp3:/var/lib/asterisk/mohmp3/acc_4 acc_5 => mp3:/var/lib/asterisk/mohmp3/acc_5 acc_6 => mp3:/var/lib/asterisk/mohmp3/acc_6 acc_7 => mp3:/var/lib/asterisk/mohmp3/acc_7 acc_8 => mp3:/var/lib/asterisk/mohmp3/acc_8 acc_9 => mp3:/var/lib/asterisk/mohmp3/acc_9 acc_10 => mp3:/var/lib/asterisk/mohmp3/acc_10
You need to save the file. Do a Ctrl+x, type y when asked if you want to save it and hit enter to save it.
Restart asterisk with the following command:
amportal restart
Add an extension in extensions_custom.conf for testing.
Anywhere between [from-internal-custom] add the following extension:
exten => 466,1,Answer exten => 466,2,Playback(pls-hold-while-try) exten => 466,3,SetMusiconHold(default) exten => 466,4,WaitmusiconHold(60) exten => 466,4,Hangup
Ctrl+x, y and enter to save the changes.
Restart asterisk:
amportal restart
Dial 466 and your music should start playing immediately.
You may have to restart your server, if you encounter any problems go back and check all your steps.
Good luck.
Note: The doted lines aren't part of the code, I used them to separate it from the rest of the writting.


Member Since:
2006-06-03