TIPS Streaming MOH / MP3 MOH / Listen to Internet radio by Phone: WORKING

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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.

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

/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
 

Hat

Guru
Joined
Dec 18, 2007
Messages
88
Reaction score
0
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?:confused5: 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.
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
A twist on the Music on Hold Streaming

:crazy: Funny... I was doing pretty much the same thing! But I took a little twist. :eek: 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. :cool: 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. :rolleyes:

I wanted to be able to select a variety of music instead of just the same channel. :smilewinkgrin: 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. :hurray: 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. :cornut:

Let me know what ya think! :cheers2:

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

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
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
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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.
 

tel0p

Guru
Joined
Nov 20, 2007
Messages
195
Reaction score
0
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...
 

jroper

Guru
Joined
Oct 20, 2007
Messages
3,832
Reaction score
71
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
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
How about "This is for educational purposes and use at your own discretion/risk." :gnorsi:

:idea: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! :smilewinkgrin:
 

kenn10

Well-Known Member
Joined
Dec 16, 2007
Messages
3,764
Reaction score
2,173
Marv -

One question....how did you determine the streams from the AOL and other channels? When I access AOL from a browser, it pops up its own player and does not seem to give any indication of IP addresses, ports, etc.
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
That's a good question.

On some sites such as Shoutcast.com, Sky.FM, and DI.fm will send you a MP3 playlist file. For example, on Sky.FM with Smooth Jazz there are 5 options. From what I have seen, you want a low bitrate MP3 file for better performance (ie low bandwidth usage, but lower quality). Sometimes the URL will give away the format. For example, if you right click on the 24k button on Smooth Jazz you will see the URL http://www.sky.fm/mp3/smoothjazz_low.pls in the properties. That file will be saved in your temporary internet files folder when you click on it to listen to the station. From what I can tell, WMA and AAC+ files are not supported by MPG123. (I may or may not be correct). Inside the PLS file will be anywhere from 1 to many URLs that are used to stream the audio you have selected. I am not familiar with how which stream is selected by the player or how long the URLs in the playlist stay active.

If you don't want to dig through your temp internet files, you can also just right click on the button and save the file to your desktop. You can even change the extension to .txt for easier opening of it to read.

You can also setup your own stream server with music, commercials, and such and just direct them to your own internal URL.

Please note, I used those websites as an example just cause most people are more familiar with them. You can google something like "royalty free stream music" and possibly find other sites too.

I ran across a few in the wee hours this morning, but forgot to bookmark them. Maybe if someone gets time they can search a few out and share with us all?

Of course, you can subscribe to a stream and the person you're purchasing it from will supply you with the url, name, and password to utilize.

Hope that made sense... it's a learning experience for me too.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
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...

Me to - I haven't figured out if I can make it NOT do that yet. Anyone else?
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
A little Change for Menu Repeat?

[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

Ok - s,10 confused me, and seemed to behave a little different than I thought. I am not very good with dial plans, but I made these changes, and it seems to allow a repeat of the menu a little easier. Let me know what you think -

exten => s,10,Read(MusicCode,beep,1)
exten => s,11,GoTo(QueueMusic,s,${MusicCode})
exten => s,12,Hangup

Also, don't forget if you have Cepstral - simply replace all occurrences of "flite" with "swift", and Allison (etc) does the menu for you.

:party:
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
I too get that wonderful buffer. Kinda like you get in the car and get to listen to 30 seconds of music before someone else changes the song on ya! LOL!
If I have another sleepless night, I might try and figure it out. I'm thinking it's a temp file being used as the buffer into asterisk that holds the music. Because if I remember correctly, I was able to reboot my server and the first MOH was the clip from the previous song. I will have to test and verify I wasn't dreaming.
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
Yeah, I like that. Makes the initial message not repeat, so less waiting! Kudos! :thumbsup:

:bigear:Question: How can we change it so we can interrupt the listing and press the key wanted instead of having to wait for the beep per say.
 

bigdog101

New Member
Joined
May 10, 2008
Messages
30
Reaction score
0
I have an old version of mpg123 install and the new version will not install. Here is what it says. I'm a linux nubee so please help.

root@pbx:/usr/src $ rpm -ivh mpg*.rpm
warning: mpg123-1.3.1-1.rh9.rf.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Preparing... ########################################### [100%]
file /usr/bin/mpg123 from install of mpg123-1.3.1-1.rh9.rf conflicts with file from package mpg123-0.59r-1

Please help
 

edisoninfo

Guru
Joined
Nov 19, 2007
Messages
505
Reaction score
4
the -i is for install, instead use a capital U for update

rpm -Uvh mpg*.rpm
 

edisoninfo

Guru
Joined
Nov 19, 2007
Messages
505
Reaction score
4
No problem. Not sure which OS version you have but I believe there is a newer version of mpg123. Something like 1.6.2 or so.
 

Members online

No members online now.

Forum statistics

Threads
25,781
Messages
167,507
Members
19,201
Latest member
troutpocket
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top