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

bigdog101

New Member
Joined
May 10, 2008
Messages
30
Reaction score
0
Is there a way to set the volumn lower. I can do it on the phone, but then the ringer is too low.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
There is a -g n switch for mpg123 - called set audio hardware output gain. I have no idea if it will change the volume of the stream or not. If you try it let us know.
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
Yeah, I thought the volume was kind of loud. But I figured I would wait and see if anyone else thought so. In a good way, it will keep them awake and maybe dancing if it's a good tune! :D

If anyone experiments with the adjustment of the volume, give us some feedback on it!
 

bigdog101

New Member
Joined
May 10, 2008
Messages
30
Reaction score
0
There is a -g n switch for mpg123 - called set audio hardware output gain. I have no idea if it will change the volume of the stream or not. If you try it let us know.

I tried the -g, but have had no luck. The music doesn't play at all.

Here are some of the one's I tried

-g 10
-g -10
-g .5
-g 0.5

dave
 

bigdog101

New Member
Joined
May 10, 2008
Messages
30
Reaction score
0
IT'S THE -f (for volume)

I figured it out. You have to set the -f lower to reduce the volume. I set my to -f 800

Here is what worked for me:

Code:
/usr/bin/mpg123 -q -s --mono -r 8000 -f 800 -b 0 http://64.62.194.49:2792
edit: note:
when I was playing with some of the parameters, I had to change the stream too. For some reason, if I changed one of the parameters without changing the stream, the stream sounded garbled.
 

Hat

Guru
Joined
Dec 18, 2007
Messages
88
Reaction score
0
I too have the buffer issue, but in addition to that the stream will stop working altogether from time to time. A system restart will fix the problem, but that does not seem like a correct way to fix it.

The log states:
DEBUG[3101] res_musiconhold.c: Read 554 bytes of audio while expecting 640

Any clues on were to look for the problem?

This is still a very cool add-on, thanks.
 

kwest

Member
Joined
Jun 28, 2008
Messages
52
Reaction score
0
Error

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.

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

2. 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.3.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:

First install a dependent file:
yum install libltdl.so.3

Second, install mpg123
wget ftp://194.199.20.114/linux/dag/redhat/9/en/i386/dag/RPMS/mpg123-1.3.1-1.rh9.rf.i386.rpm
rpm -ivh mpg*.rpm
rm mpg123-1.3.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]:

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.

Good luck!

I am getting this message
Connecting to 194.199.20.114:21... connected.
Logging in as anonymous ... Logged in!
==> SYST ... done. ==> PWD ... done.
==> TYPE I ... done. ==> CWD /linux/dag ... done.
==> SIZE redha...h9.rf.i386.rpm ... done.
==> PASV ... done. ==> RETR redha...h9.rf.i386.rpm ...
No such file `redha...h9.rf.i386.rpm'.
 

dghundt

Guru
Joined
Nov 15, 2007
Messages
603
Reaction score
52
I played with streaming MOH over a year ago on an AAH 2.7 box. It worked fine except sometimes the streaming just stopped and had to reboot to get it going again. I gave up on it after that.
 

jmullinix

Guru
Joined
Oct 21, 2007
Messages
1,263
Reaction score
7
Doc,

I just set this up at one of the radio stations to put the FM audio on the hold circuit for the FM side of the building. It has been running perfectly for 3 days now. This same machine also has Sound Card Music on Hold for the AM side of the building. I will keep my fingers crossed. Ping me in about a week and I will give you an update.
 

Hat

Guru
Joined
Dec 18, 2007
Messages
88
Reaction score
0
Does it happen on more than one stream?
Yes. Twice this has occurred were one stream would play what appearred to be the buffer and then the music would stop. Trying all the other streams resulted in the same outcome.

One other instance, all but one stream stopped working.:confused5:

I only use this while I am at my desk, about an hour per night. This behavior usually happens after two or three days of using the MOH stream this way.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Try an mpg123 update

Yes. Twice this has occurred were one stream would play what appearred to be the buffer and then the music would stop. Trying all the other streams resulted in the same outcome.

One other instance, all but one stream stopped working.:confused5:

I only use this while I am at my desk, about an hour per night. This behavior usually happens after two or three days of using the MOH stream this way.

This actually happened to me a bit to - I updated to a newer version of mpg123 and it hasnt happened since. Check my first post on this thread for the link to the newest mpg123 and instructions how to update. Let us know if that helps.
Tony
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
Another new twist. Interruptable Menus

Ok - Building On Marvs Selection menu idea, here are some steps to take if you want to be able to interrupt your menu (not have to wait for it to complete before making your selection.)

These steps also register the MUSIC extension with FreePBX as both a Custom Destination and Misc Application, in a much better way than the first version I provided. With this technique, FreePBX will be aware of the 68742 extension and wont let you use it again by accident, and better isolates the menu choices from the main inbound context (no chance of conlficts with single digit extensions.)

Step 1:
Get mpg123 installed as described in this thread's first entry.

Step 2:
In FreePBX 2.5.x goto MOH, and add streaming categories as you see fit. You will want to define one streaming category for each streaming `channel` you want to add to your menu.
The Category name you assign will be used later in the dial plan. I like to try and keep them a little descriptive. (They are case sensative!)
Substitute your streams url information instead of http://160.79.128.61:7826

Code:
Category Name:  Christmas
Application: /usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://160.79.128.61:7826


Step 3:

In FreePBX create a Custom Destination.
Code:
Customer Destination:  music,s,1
Description: Telephone Music


Step 4:

In FreePBX create a Misc Application.
Code:
Description: Telephone Music
Feature Code: 68742 
Destination: Custom Destinations: Telephone Music


Step 5:

Using FreePBX Config Edit, add the following dial plan to extension_override_freepbx.conf.

In this dial plan, for the lines that begin with `MusicOnHold` - the values inside the parenthesis must exactly match the streaming category names you created in step 2, above.

Code:
[music]
exten => s,1,Answer
exten => s,2,Background(custom/telephonemusic)
exten => s,3,WaitExten(,)
exten => s,4,NoOp()
;dial users
exten => 1,1,MusicOnHold(showtunes)
exten => 2,1,MusicOnHold(60s)
exten => 3,1,MusicOnHold(Christmas)
exten => 4,1,MusicOnHold(SkyFM)
exten => 5,1,MusicOnHold(Classical)
exten => 6,1,MusicOnHold(default)
exten => 9,1,Background(custom/musicmenu)
exten => 9,2,WaitExten()
exten => 9,3,Goto(music,4)
exten => t,n,Hangup
More details about the dial plan:
This exmaple shows support for 6 choices, you can easily expand it to more by adding additional lines like:
exten => 7,1,MusicOnHold(category1)
exten => 8,1,MusicOnHold(category2)
and so on.

Its also possible to create menu choices with more than one digit.
exten => 10,1,MusicOnHold(category2)
would respond to the user entering [1][0] on their touch tone pad.

The lines that begin with `exten => 9` allow the user to replay the menu choices, and 9,3 sends it back to s,4 so the menu choice can be acted upon.


Step 6: Prepare the sound files.
Create 2 sound files for the music system. The files will be played back by the background command. You can record them in your own voice, or create them with swift (Cepstral) or flite.
To use flite/swift, create 2 text files containing the things you want spoken.

telephonemusic.txt should contain text something lie this:

Code:
Welcome to telephone music.
Please press 1 through 6 to select your music channel.
or
press 9 for a menu of channels and their descriptions.
musicmenu.txt should contain text something like this: (you will obviously want to edit the contents to reflect the actual streaming MOH channels you have set up.)

Code:
Welcome to telephone music.
Please press 1 through 6 to select your music channel.
Channel 1 is the Show Tunes channel..
Channel 2 is Music from the sixties.
Channel 3 is mixed Style Christmas Music.
Channel 4 is Sky F.M. - Mostly Classical Music.
Channel 5 is All Classical Music All of the time.
Channel 6 is the Standard "Hold Music".

Press 9 to here the menu again.
Upload those files to your pbx. I use winscp, and place them in /root.
Log into your pbx (I use putty), and cd /root

Flite and swift have the same syntax. From putty:

Code:
swift -f telephonemusic.txt -o telephonemusic.wav
swift -f musicmenu.txt -o musicmenu.wav
or 
flite -f telephonemusic.txt -o telephonemusic.wav
flite -f musicmenu.txt -o musicmenu.wav


Step 7:
Upload the sound files to System Recordings.

The actual next step is to use winscp to move the wav files we created in step 6 back to your local PC. No reason to let them build up in the /root folder. I use winscp to move them back to a storage folder on my pc.
Then, using FreePBX, upload the two new recordings using the System Recording upload function.
I usualy do an amportal restart at this time, although its probably NOT really needed.
New Info: User `Hat` (Tom) says that he needed a restart of the computer to get this working right - so consider trying that if it doesn't work right away for you!

Step 8: Pick up a phone and dial 68742 (MUSIC), and try it out.

Let me know how this works for
 

Hat

Guru
Joined
Dec 18, 2007
Messages
88
Reaction score
0
Tony,

Thanks for the heads up on mpg123, that seems to have done the trick with the stalls. Also, your write up to incorporate this into FreePBX is spot on, works like a champ
:party:
A big thanks to you and marv for figuring this out and offering it to others.

Just an FYI, amportal restart did not work for me after following your write up. I had to restart the box to get it to work.
 

angoyr

Guru
Joined
Apr 1, 2008
Messages
171
Reaction score
0
Ok,
I followed these instructions and I got MOH working. The problem is that Asterisk wouldn't restart after starting and stopping MOH. I have to do an amportal restart twice for asterisk to start.

How do I remove the mpg123 application? I appears as though the channel isn't hanging up when you turn off MOH.

Any help would be appreciated.

Thanks.
 

tshif

Guru
Joined
Jan 3, 2008
Messages
1,240
Reaction score
4
This should do what you want.

rpm -e --nodeps mpg123

The problem is that Asterisk wouldn't restart after starting and stopping MOH. I have to do an amportal restart twice for asterisk to start.
I am curious how you `turned off` music on hold, and also exactly what you mean when you say the `channel isn't hanging up`.
 

marv

Member
Joined
Nov 26, 2007
Messages
84
Reaction score
2
I did have a period where I was having trouble using the Amportal Restart command. From what I could tell was that MPG123 was not ending soon enough. Maybe a call was recently put on hold with MOH or something like that. I noticed that the start command was being issued before the stop command had finished. A timing issue maybe? Could be that the machine is slow, something else is going on, or possibly should have a file that checks to ensure the process has completely stopped before trying to restart it. I would suggest maybe issuing "amportal stop" and then waiting for it to show it was stopped. Then use "amportal restart" since it does kill the mpg123 processes and I don't think amportal start does. Just what I encountered a while back...
 

Members online

Forum statistics

Threads
25,811
Messages
167,759
Members
19,240
Latest member
nikko
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