Shoutcast Streaming MOH for Trixbox 2.0 Instructions

cbrogers
Posts: 90
Member Since:
2006-06-26

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!



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

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

--


New & Improved Site: trixbox Maintenance Guides



gtidave
Posts: 22
Member Since:
2006-12-11
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

This is great!

Now to find some local radio station streams...

Thanks!
Dave

--

Dave
519-489-7067 - E164 listed
Always learning...



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

for anyone living in NYC, does anyone know how to stream z100 (100.3 FM)? they have a streaming feature on their website but it plays through their website.
thanks

--


New & Improved Site: trixbox Maintenance Guides



iSEPIC
Posts: 63
Member Since:
2006-08-10
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

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"

alt="" />http://i11.tinypic.com/2hgw7yu.jpg" alt="" />http://i18.tinypic.com/4c9jh8w.jpg" alt="" />

Here is the PHP code I extracted from z100.com:


WHTZ-FM
Clear Channel On-line Music and Radio, Inc.
Copyright (c)2007, Clear Channel On-line Music and Radio, Inc.

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""

target="_blank">" target="_blank">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

ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

sometimes the music stops playing out of nowhere for a few minutes. anyone know what to do in such a case?
thanks

--


New & Improved Site: trixbox Maintenance Guides



gtidave
Posts: 22
Member Since:
2006-12-11
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

Sounds like you are having problems buffering. Pick a different stream! :lol: Make sure to pick a low bitrate stream, they are less popular and consume much less bandwidth.

Dave

--

Dave
519-489-7067 - E164 listed
Always learning...



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

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

--


New & Improved Site: trixbox Maintenance Guides



cbrogers
Posts: 90
Member Since:
2006-06-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

I don't think there is a way to have it stream all the time. Music on Hold starts when you request it.



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

alright i see
so if i leave x-lite on 24/7, streaming the music, would i "kill" the network card of the asterisk server for continuous bandwidth processing?-i currently do not have failover so that's why im concerned.
thanks

--


New & Improved Site: trixbox Maintenance Guides



cbrogers
Posts: 90
Member Since:
2006-06-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

Mine creates a buffer from the previous song, then it just starts into the new stream after a few seconds. Not a big deal for me, but I also don't want the bandwidth to stream all the time.



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

mine does that too but after the previous buffer the music would just cut off
i dont care about my bandwidth because i have 30Mpbs. so am i killing my card by continuously streaming?

--


New & Improved Site: trixbox Maintenance Guides



iSEPIC
Posts: 63
Member Since:
2006-08-10
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

For the stopped stream, I have noticed that it is stopping even when listening to it direct (click the mms link I posted above) - it does say on the z100 web site their streaming will go down a few times due to them upgrading.. maybe that is the problem.



ja133
Posts: 1881
Member Since:
2006-11-26
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

im not using z100
but im trying to find a way to stream it

im using .977 Hits from shoutcast

--


New & Improved Site: trixbox Maintenance Guides



goingup
Posts: 6
Member Since:
2007-01-30
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

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.



bocar
Posts: 50
Member Since:
2006-06-01
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

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?



bocar
Posts: 50
Member Since:
2006-06-01
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

This really works. I am having good results except for the volume blaring. Is there anyway to attenuate the volume with this setup? I need to tone it down a little. It is so loud it startles some callers.



John_in_NC
Posts: 50
Member Since:
2006-10-19
Re: Shoutcast Streaming MOH for Trixbox 2.0 Instructions

I had to reboot before I could paste the Streams in but still only hearing my default MOH!

Disregard, with all the patches I installed I tightened my firewall and dis-trusted Trixbox from internet access. My bad.

--

Running Trixbox v2.6.0.7



merki
Posts: 7
Member Since:
2006-08-10
The guide is great, if I

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...



kspare
Posts: 550
Member Since:
2007-02-16
Stick with mp3 or wav files

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.



johnakabean
Posts: 2
Member Since:
2008-02-04
relay might fix the buffer!!!

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 :-)



martijnr17
Posts: 19
Member Since:
2006-06-09
howto for 2.4

Hi,

I have tried de instruction on my 2.4 server but it isnt working.
As far as I can see ther is no mpg123 player? tried installing but i'm getting an error?

Hopefulle somebody can help.



ja133
Posts: 1881
Member Since:
2006-11-26
Same story here : (

Same story here : (

--


New & Improved Site: trixbox Maintenance Guides



ja133
Posts: 1881
Member Since:
2006-11-26
Ok I searched around.

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!

--


New & Improved Site: trixbox Maintenance Guides



jake
Posts: 104
Member Since:
2007-03-23
I'm pretty sure this is a

I'm pretty sure this is a stupid question but, is TB streaming ONLY when a call is placed on hold or whenever "mpg" is being invoked?

It's not running in the background at any time is it?



ja133
Posts: 1881
Member Since:
2006-11-26
It only runs when the caller

It only runs when the caller is placed on hold and it continues for about a minute or two afterwards

--


New & Improved Site: trixbox Maintenance Guides



kspare
Posts: 550
Member Since:
2007-02-16
why the old rpm though?

why the old rpm though? there are much newer version than that.



ja133
Posts: 1881
Member Since:
2006-11-26
I guess that's the one I

I guess that's the one I found at the time.
I'm not too knowledgable with Linux commands so this was the only successful source I got out of all the other websites I look at

--


New & Improved Site: trixbox Maintenance Guides



kspare
Posts: 550
Member Since:
2007-02-16
I found the latest rpms....I

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



kspare
Posts: 550
Member Since:
2007-02-16
If you are running this on

If you are running this on 2.6 you can install esound via yum to get the latest version.

My only problem is that if the internet drops the music doesn't come back right away?



ja133
Posts: 1881
Member Since:
2006-11-26
Correct I also dont like

Correct
I also dont like that occasionally the music just stops working completely and will work again after 5 minutes of calls not placed on hold

--


New & Improved Site: trixbox Maintenance Guides



kspare
Posts: 550
Member Since:
2007-02-16
I haven't had that problem

I haven't had that problem running the latest version of mpg123 its just if the net drops it doesnt recover very fast.



ja133
Posts: 1881
Member Since:
2006-11-26
Yes that too But think about

Yes that too
But think about it, how often does the net actually drop on you?
I never had an unplanned internet outage in 6 years, starting from my home and moving on to my office

--


New & Improved Site: trixbox Maintenance Guides



atilio
Posts: 69
Member Since:
2006-06-01
Multiple streams

Is there a way to assign a different stream to each separate queue? or do they have to use the default stream?



Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.