Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-08, 02:50 AM
tshif tshif is offline
Guru
 
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
Streaming MOH / MP3 MOH / Listen to Internet radio by Phone: WORKING
Updated on August 5 2010 for new version of MPG123 and tested on PBXIAF 1775x)

I only recently got to start playing with PBXIAF 1.3 (getting ready to upgrade a few 1.0-1.2 versions), and found that most everything just sorta works the way its supposed to.

Tom, Ward, Joe - what can we all say but WOW.

There were just a couple things that seemed a little odd "out of the box" about music on hold, and streaming music on hold.

A. When we tried uploading our mp3 formatted audio files for MOH, we got the dreaded sh:mpg123 error, and no WAV versions were produced. The MP3 version were listed, and music on hold DID still work. But we prefer the old functionality of having the WAV versions on the list in FreePBX. (This step is STILL desireable on PBXIAF v 1775x - its not there by default.)

B. The new extra cool streaming music on hold category would not work - period.

It turns out the solution for both was to install mpg123. After searching around the forums, most of the instructions didn't work, or referenced really old versions of mpg123.

This procedure gets version 1.8.1-1 of mpg123 which is much newer than other version Ive seen referenced - but I decided to try it anyway.

Here is what we did to install it:

Step 1: First install a dependent file:
Code:
yum install  libesd.so.0 (This step isn't needed on PBXIAF v 1775x)
Step 2: Second, install mpg123
Code:
wget http://apt.sw.be/redhat/9/en/i386/RPMS.dag/mpg123-1.8.1-1.rh9.rf.i386.rpm
  rpm -ivh mpg*.rpm
  rm  mpg123-1.8.1-1.rh9.rf.i386.rpm
  amportal restart
That fixed the MP3 to WAV MOH issue, as well as the streaming MOH. To test that, (using FreePBX 2.5.1) goto MOH, add streaming category. Use a line like this in the APPLICATION field:

Quote:
/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://160.79.128.61:7826
Many users have asked for the ability to listen to streaming internet music on their telephone. To do that - we make the following additional dial plan to [from-internal-custom]:

Code:
exten => 69,1,Answer
exten => 69,2,MusicOnHold(stream)
exten => 69,3,Hangup
We program a speed dial key on the telephones and label it 'RADIO', which dials ext 69 (change as you see fit), and plays the Streaming MOH - which we so creatively named stream.
I have been trying to get streaming to work for a long time. I hope that this may help someone in the same situation.

There is a good reason I didn't talk about using live streams for an actual "Music On Hold" purpose. These techniques should only be used for your personal listening enjoyment in a household setting. Any other use probably breaks laws. Expensive ones.

Note: I have updated these instructions to reference an even newer mpg123 - that for me suffers way fewer `stream stalls`. If you're doing this for the first time, just follow the directions above. If you are UPDATING from a previous version of mpg123, in step 2 above, instead of doing rpm -ivh mpg*.rpm- use:
Code:
rpm -Uvh mpg*.rpm
(Thanks edisoninfo for posting that!)
The steps outlined in this article produce a very simple ability to listen to streaming music through your phones. See this article for a version that adds user Marv's menu ideas and add the ability to interrupt the menus, and better use of FreePBX extension registrations.


Good luck!
Tony

Last edited by tshif : 08-05-10 at 05:54 PM. Reason: Fixed path (new) to mpg123; Added note about v1775x
Reply With Quote
  #2  
Old 11-13-08, 12:04 AM
Hat Hat is offline
Guru
 
Join Date: Dec 2007
Posts: 84
I followed your instructions and when I dial 69 I get the stream on my phone. Thanks for the info and the how to. I do have one question, how do I get this or any other stream as my default MOH? I can't delete all the original wav files in the default MOH setting of FreePBX. I only get the one remaining file playing.

Tom

*Edit* Nevermind, marv's post below did the trick.

Last edited by Hat : 11-13-08 at 12:09 AM. Reason: I'm a bonehead
Reply With Quote
  #3  
Old 11-13-08, 12:05 AM
marv marv is offline
Member
 
Join Date: Nov 2007
Location: Atlanta, GA
Posts: 80
A twist on the Music on Hold Streaming
Funny... I was doing pretty much the same thing! But I took a little twist. After you have all the proper files installed to play, I ran yum -y update and it installed an even newer version of mpg123 1.6.1 along with a few other files. So my part assumes you have the proper files installed to have mpg123 working as above. Oh yeah, one more thing... my code uses FLITE for text to speech. So search for the install instructions on this site before you proceed.

I wanted to be able to select a variety of music instead of just the same channel. Note the channels I grabbed are just random and not low bitrates, so you may wish to change them.
Here's my etc/asterisk/musiconhold.com
[80s]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://scfire-mtc-aa04.stream.aol.com:80/stream/1040
[Hitz]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://scfire-dtc-aa02.stream.aol.com:80/stream/1074
[Jazz]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://scfire-ntc-aa10.stream.aol.com:80/stream/1074
[KickinCountry]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://scfire-ntc-aa09.stream.aol.com:80/stream/1075
[MaxHits]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://91.121.201.60:80
[SwissGroove]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://82.197.167.134:80
[TheEagle-ClassicRock]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.72.118.64:8030
[Top40-Christmas]
mode=custom
application=/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.62.194.49:2792
[default]
mode=files
directory=/var/lib/asterisk/mohmp3/
random=yes
[none]
mode=files
directory=/dev/null


Then I modified my /etc/asterisk/extensions_custom.conf
In the [from-internal-custom] section I added:
exten => 68742,1,Answer
exten => 68742,2,Flite("After the beep press the number of the music channel you wish to listen to. Or 9 for a list of channels.")
exten => 68742,3,Read(MusicCode,beep,1)
exten => 68742,4,GoTo(QueueMusic,s,${MusicCode})
exten => 68742,5,Hangup

Then I scrolled to the bottom of the file and added a new section

[QueueMusic]
exten => s,1,MusicOnHold(80s)
exten => s,2,MusicOnHold(Jazz)
exten => s,3,MusicOnHold(KickinCountry)
exten => s,4,MusicOnHold(Hitz)
exten => s,5,MusicOnHold(MaxHits)
exten => s,6,MusicOnHold(SwissGroove)
exten => s,7,MusicOnHold(TheEagle-ClassicRock)
exten => s,8,MusicOnHold(Top40-Christmas)
exten => s,9,Flite("Press 1 for eighties. 2 for Jazz. 3 for Kickin Country. 4 for Hitz. 5 for Max Hitz. 6 for Swiss Groove. 7 for The Eagle Clasic Rock. 8 for Top 40 Christmas. 9 to hear this list again.")
exten => s,10,goto(from-internal-custom,68742,2)
exten => s,11,Hangup

Then I saved all my files and did an "amportal restart" for the changes to take effect. Now you can dial MUSIC or 68742 and it will ask you which channel you wish to listen to and play that stream. If you wish to change the names and such, just make sure you change them in all places. This is the first time I've ever written anything with asterisk, so feel free to correct me or make improvements. But it's a lot more information and ability than I have been able to find yet. No error checking for wrong keys and such, cause I haven't read up that far yet. Maybe one day or someone else.

So that's my little twist on the Streaming MOH. Of course, after you have done the restart, you can go into your trunk configs and set the MOH option there to whatever streams you wish to use too.

Let me know what ya think!

-Marv
- Cool tips like this are available because Ward has been nice enough to setup this board. If you find this useful, drop him some loose change to help him get a better server going ( http://pbxinaflash.com/forum/misc.php?do=donate )

Last edited by marv : 11-15-08 at 10:05 AM.
Reply With Quote
  #4  
Old 11-13-08, 01:17 AM
tshif tshif is offline
Guru
 
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
Awesome! Its great you posted your mods. It really is a great learning experience (and fun) to see how you handled the tweaks. I love the menu - THANKS for sharing!

Tony
Reply With Quote
  #5  
Old 11-13-08, 01:38 AM
jroper jroper is offline
Guru
 
Join Date: Oct 2007
Posts: 3,333
Hi

I love what you are doing, its a great effort, but one little word of warning before you implement this.

If you are using internet telephony and streaming music, make sure that you have enough broadband to do both sucessfully, because you don't want so much bandwidth consumed that you cannot make a decent phone call.

Secondly, In the UK, if you play music on hold, or rebroadbast radio, you have to have a licence as MOH is a public broadcast license. You even have to have one of these if you play the radio at work.

The same may apply in other countries:-

http://www.ppluk.com/en/Music-Users/

The exception to this is the MOH included with Asterisk as that is under the creative commons licence, and you can also find other music released under the creative commons licence, or royalty free music, which often is not of best quality. Ever wondered why music played in Lifts (Elevators) is so cheesy.

One of my customers had to argue the above point with the authorities, he won.

Joe
Reply With Quote
  #6  
Old 11-13-08, 01:43 AM
tshif tshif is offline
Guru
 
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
Originally Posted by Hat View Post
I followed your instructions and when I dial 69 I get the stream on my phone.
Excellent! Glad it worked for you too! I'm gonna try the menu ideas that Marv shared.
Reply With Quote
  #7  
Old 11-13-08, 04:12 AM
tshif tshif is offline
Guru
 
Join Date: Jan 2008
Location: San Diego, Calif
Posts: 1,131
Joe - so very true what you are saying. They make the software police look almost tame when they come for you for a violation. To all, If your doing this, either use it for home only where its not any form of public rebroadcast. Trust me - err on the side of safety in this issue. Its one reason I didnt include info on how to use this for actual MOH - a place the public (inbound callers) is reasonably expected to be from time to time.
Reply With Quote
  #8  
Old 11-13-08, 06:08 AM
tel0p tel0p is offline
Guru
 
Join Date: Nov 2007
Location: Seattle, WA
Posts: 195
This is very cool. Nice job.

Not to go OT, but is there a reason why there's like a 30second buffer of streamed music, then it quick-cuts to the live stream? (At least it's doing this for me). Maybe it's a switch on mpg123 I'm missing...
Reply With Quote
  #9  
Old 11-13-08, 01:16 PM
jroper jroper is offline
Guru
 
Join Date: Oct 2007
Posts: 3,333
Quote:
either use it for home only where its not any form of public rebroadcast
I'd go as far as to say even at home, you are on shaky ground if you are using it for Music on Hold, as any member of the public can call you.

However, I would not envisage any problems using it at home to listen to music though your telephone speakers.

Joe
Reply With Quote
  #10  
Old 11-13-08, 02:42 PM
marv marv is offline
Member
 
Join Date: Nov 2007
Location: Atlanta, GA
Posts: 80
How about "This is for educational purposes and use at your own discretion/risk."

Maybe you know of free streams or have setup your own server with advertisements and such. The ideas are endless, this is just a very basic framework which I have not been able to find.

And if you are using it at home and the "music police" call to check on your system, just hang up... don't put them on hold!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:01 PM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin®
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007-2008, Ward Mundy & Associates