Shoutcast Streaming MOH for Trixbox 2.0 Instructions
I have written a document that outlines how to setup Shoutcast Streaming MOH for Trixbox 2.0. Please test and let me know what you think. I want to think many people here for coming up with bits and pieces.
If you have mpg123 installed, you can check which version you have my typing the below from the command line. If it is not installed it will not return anything.
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 http://www.mpg123.de/mpg123/mpg123-0.59r.tar.gz
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_additional.conf file and comment out the following lines:
;[default]
;mode=files
;directory=/var/lib/asterisk/mohmp3/
;random=yes
Next we will need to create a new conf file that will hold our settings so that Freepbx does not wipe them out:
cd /etc/asterisk
touch musiconhold_custom.conf
chown asterisk musiconhold_custom.conf
chmod 664 musiconhold_custom.conf
Once the file is created, you will copy and paste the following into musiconhond_custom.conf using Config Edit from Freepbx:
[default]
mode=custom
directory=/var/lib/asterisk/mohmp3/stream
[default]
mode=custom
directory=/var/lib/asterisk/mohmp3/stream
;24k SKY.FM 80's
;application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://212.71.8.6:8766/
;24k SKY.FM Top 40's
application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://212.23.5.99:8006/
;24k SKY.FM Soft Smooth Jazz
;application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://38.101.216.30:8000/
;56k Hard Rockin 80's Hair Bands
;application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://204.9.117.202:8112/
;24k SKY.FM Hit Country
;application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://128.177.3.80:4064/
When pasting the above lines, make sure that the application is on one continuous line.
After completing this, just uncomment out which stream you want to use. Currently the stream that will work will be the Top 40’s. These are all 24k streams except for one, so they use very little bandwidth plus you don’t need anymore than that for a moh.
You can then add the following to extensions_trixbox.conf using Config Edit in Freepbx to test:
exten => 68742,1,Answer
exten => 68742,2,MusicOnHold
exten => 68742,3,Hangup
You will need to reload asterisk after this is complete:
amportal restart
After Asterisk restarts, pick up the phone and dial 68742 (MUSIC).
Enjoy!
works awesome! this is the first time i got streaming to work!
for those interested in "up to date" music, put thisi into musiconhold_custom.conf
;977 Hits
application=/usr/local/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://scfire-dll0l-2.stream.aol.com:80/stream/1074
Looks like they are streaming via MMS:// - so you'll have to transcode it, not going to be easy to do on Asterisk. If you REALLY want to do this, you can use VideoLan (VLC), and cut and paste the MMS:\\ below into the stream, click on the wizard, and transcode and stream it youself to your asterisk box. Good luck, and I hope it works.
EDIT: Okay I'm not sure why the screenshots are not coming through, you'll have to click on them below. Sorry something messed up between preview and submit here.
http://i18.tinypic.com/2h7p2fm.jpg"
Here is the PHP code I extracted from z100.com:
mms://a1998.l1997243784.c19972.g.lm.akamaistream.net/D/1998/19972/v0001/reflector:43784&CPROG=SIMULCAST&MARKET=NEWYORK-NY&NG_FORMAT=chr&NG_ID=whtz100fm&OR_NEWSFORMAT=&RVN_TZ=-5&SERVER_NAME=www.z100.com&SITE_ID=1793&STATION_ID=WHTZ-FM&STATION_ID=WHTZ-FM""
mms://a158.l1997243785.c19972.g.lm.akamaistream.net/D/158/19972/v0001/reflector:43785&CPROG=SIMULCAST&MARKET=NEWYORK-NY&NG_FORMAT=chr&NG_ID=whtz100fm&OR_NEWSFORMAT=&RVN_TZ=-5&SERVER_NAME=www.z100.com&SITE_ID=1793&STATION_ID=WHTZ-FM&STATION_ID=WHTZ-FM"" target="_blank">" target="_blank">mms://a158.l1997243785.c19972.g.lm.akamaistream.net/D/158/19972/v0001/reflector:43785&CPROG=SIMULCAST&MARKET=NEWYORK-NY&NG_FORMAT=chr&NG_ID=whtz100fm&OR_NEWSFORMAT=&RVN_TZ=-5&SERVER_NAME=www.z100.com&SITE_ID=1793&STATION_ID=WHTZ-FM&STATION_ID=WHTZ-FM" />
http://mfile.akamai.com/19972/live/reflector:43784.asx?bkup=43785&CPROG=SIMULCAST&MARKET=NEWYORK-NY&NG_FORMAT=chr&NG_ID=whtz100fm&OR_NEWSFORMAT=&RVN_TZ=-5&SERVER_NAME=www.z1" target="_blank">http://mfile.akamai.com/19972/live/reflector:43784.asx?bkup=43785&CPROG=SIMULCAST&MARKET=NEWYORK-NY&NG_FORMAT=chr&NG_ID=whtz100fm&OR_NEWSFORMAT=&RVN_TZ=-5&SERVER_NAME=www.z1
i tried that!
still same issue
i did realize that as long as i keep a phone listening to the music on hold, i would hear the streaming. i realized that when no phones are listening to mmusic on hold, nothing is streamed.
so is there a way that i can just tell asterisk to continuously stream the music? right now i have a domain controller so i put x-lite on it and thats how im keeping the music "alive"- but i dont want to do this.
thanks
Thanks for this post, I've at least got the music playing.. however, it's like blaring through the headset.. has anyone else experienced this?? I've stopped and started asterisk a few times.. same result.. any clue why, or how to tone down mpg123 so that it's not so loud??
[FIXED!]
Ok, I was using the latest version of mpg123. Reverting to an earlier version and restarting the system solved my volume problem.
Pretty exciting that this works! Thanks for the clear prcedure.. I am still having the blaring that 'goingup' mentioned. I am not so lucky I tried three versions of mpg123 from q thru pre-s and no change. I see a gain option in mpg123 but the man page says not to change it. Bottom line how do I adjust the volume to ear tolerance levels?
The guide is great, if I dial the extension I make for musiconhold it plays down the line. But this may be a dumb question, how do I configure this stream in FreePBX -> MusicOnHold. I thought it obvious saw it made a queue called stream with the stream.mp3 file inside. However when I select this as hold music I get dead air, if i switch back to the generic hold music that plays fine.
Also when I amportal restart I get this :
Junk at the beginning ed6c52f9
mpg123: Can't rewind stream by 607 bits!
The number of bits is always different & mostly lists 2 or 3 times. It will also re-occur every 10 minutes in the console. Its from the musiconhold_custom.conf as when I rm this file the problem goes away but then that doesnt really narrow it down :)
If I let this go after about 10 repeats of this I get "File is too big" stream down the console then my hold music extension becomes a dead line...
Stick with mp3 or wav files on the server. I messed around with mpg123 and some shoutcast radio stations, I ended up just using the included mp3 moh files. The music doesn't drop out and will always play, the same can't be said for streaming mp3.
I still use the streaming mp3 but just to play music over the phones to listen to, and even then it's not reliable.
You could setup a shoutcast server just to relay the music which would, itself, buffer the stream and, since the shoutcast would be on your trixbox, the stream would not need any buffering in between!
Its been a while since i fooled with shoutcast but I'll give it a go and, if it fixes the problem, i'll come back and post instructions on how to setup the config for both. Currently, I'm looking for a way to use multiple streams, which is going to be a hassle if I have to relay them all through individual shoutcasts's.
Right now, I have a radio station playing (and stopping) that I don't even know where is coming from. The musiconhold config files don't show the stream as they have hip-hop and gopsel streams listed; a rock station is playing on the phone!?!?! I'm still searching through config files :-)
Ok I searched around and I got it working!!
Install mpg123 like this:
1. wget ftp://rpmfind.net/linux/dag/fedora/2/en/i386/dag/RPMS/mpg123-0.61...
2. rpm -ivh mpg*.rpm
3. mpg123 -v ;(if you see some help imformaiton, it mean mpg123 installed)
This is my musiconhold_custom file:
[default]
mode=custom
directory=/var/lib/asterisk/mohmp3/stream
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.72.127.74:8002/
Replace http://64.72.127.74:8002/ with the proper stream link. Notice the difference- in tb2.2 it is application=/usr/LOCAL/bin/mpg123
there's no "local" directory in trixbox 2.4 that leads to mpg123
Enjoy!
Now, if anyone knows how to lower the volume- that would be great!
I found the latest rpms....I used this and it's actually working now...holy crap!!
wget ftp://194.199.20.114/linux/redhat/9/en/os/i386/RedHat/RPMS/esound...
wget ftp://194.199.20.114/linux/dag/redhat/9/en/i386/dag/RPMS/mpg123-1...
rpm -ivh es*.rpm
rpm -ivh mpg*.rpm


Member Since:
2006-06-26