| Asterisk Support Forum Technical support, how-to guides, troubleshooting, and general assistance, from beginner to seasoned pro, this is where to discuss Asterisk, the most powerful open source PBX. |  | | 
August 1st, 2005, 09:03 PM
| | Junior Member | | Join Date: Jun 2005
Posts: 29
| | Problems with Music on Hold I'm having problems setting up the music on hold feature. The only one I can get to do anything is the default sample from the musiconhold.conf. However even with it I do not hear any music. I am testing this dialing 6601 (see extract from extensions.conf) from a kphone (on another system) that is registered with my Asterisk server. If I comment the default context and uncomment any of the others it immediately disconnects after I dial. With the default it stays connected until I hangup or the timeout vaue is reached.
musiconhold.conf Code: ;
; Music on hold class definitions
;
[classes]
;JS;
default => quietmp3:/var/lib/asterisk/mohmp3
;loud => mp3:/var/lib/asterisk/mohmp3
;random => quietmp3:/var/lib/asterisk/mohmp3,-z
;unbuffered => mp3nb:/var/lib/asterisk/mohmp3
;quietunbuf => quietmp3nb:/var/lib/asterisk/mohmp3
; Note that the custom mode cannot handle escaped parameters (specifically embedded spaces)
;manual => custom:/var/lib/asterisk/mohmp3,/usr/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s
;streaming => slimp3 => custom:/var/lib/asterisk/mohmp3-dummy,/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.62.253.225:10622/
Extract from extensions.conf Code: ;JS; Added to test music on hold
exten => 6601,1,Answer
exten => 6601,2,NoOp(CP1)
exten => 6601,3,WaitMusicOnHold(30)
exten => 6601,4,NoOp(CP1)
exten => 6601,5,Hangup
Here is the console session output with the default context: Code: [root@jps1]/etc/asterisk# asterisk -vvvvvvvgcr
== Parsing '/etc/asterisk/asterisk.conf': Found == Parsing '/etc/asterisk/extconfig.conf': Found
Asterisk 1.0.7, Copyright (C) 1999-2004 Digium.
Written by Mark Spencer <markster@digium.com>
=========================================================================
Connected to Asterisk 1.0.7 currently running on jps1 (pid = 21580)
Verbosity was 3 and is now 7
Asterisk Ready.
-- Remote UNIX connection
-- Executing Answer("SIP/kphone-ee75", "") in new stack
-- Executing NoOp("SIP/kphone-ee75", "CP1") in new stack
-- Executing WaitMusicOnHold("SIP/kphone-ee75", "30") in new stack
-- Started music on hold, class 'default', on SIP/kphone-ee75
Jul 29 16:29:49 NOTICE[21603]: rtp.c:430 ast_rtp_read: RTP: Received packet with bad UDP checksum
-- Stopped music on hold on SIP/kphone-ee75
-- Executing NoOp("SIP/kphone-ee75", "CP1") in new stack
-- Executing Hangup("SIP/kphone-ee75", "") in new stack
== Spawn extension (default, 6601, 5) exited non-zero on 'SIP/kphone-ee75'
jps1*CLI>
And here is the console output with any other context: Code: [root@jps1]/etc/asterisk# asterisk -vvvvvvvgcr
== Parsing '/etc/asterisk/asterisk.conf': Found
== Parsing '/etc/asterisk/extconfig.conf': Found
Asterisk 1.0.7, Copyright (C) 1999-2004 Digium.
Written by Mark Spencer <markster@digium.com>
=========================================================================
Connected to Asterisk 1.0.7 currently running on jps1 (pid = 21541)
Verbosity was 3 and is now 7
Asterisk Ready.
-- Remote UNIX connection
-- Executing Answer("SIP/kphone-d2e4", "") in new stack
-- Executing NoOp("SIP/kphone-d2e4", "CP1") in new stack
-- Executing WaitMusicOnHold("SIP/kphone-d2e4", "30") in new stack
Jul 29 16:28:43 WARNING[21562]: res_musiconhold.c:370 moh1_exec: Unable to start music on hold for 30 seconds on channel SIP/kphone-d2e4
== Spawn extension (default, 6601, 3) exited non-zero on 'SIP/kphone-d2e4'
jps1*CLI> quit
Any ideas what is wrong and how to fix it?
Ultimately I would like to use a streaming audio source like the last streaming context I have commented in my musiconhold.conf. I am not sure if this is a valid source URL for this. How can I confirm this is a good URL? | 
August 1st, 2005, 09:55 PM
|  | Senior Member | | Join Date: Aug 2004 Location: USA or Japan
Posts: 5,013
| | RE: Problems with Music on Hold Here is my musiconhold.conf. To make streaming work you need to first create a subfolder called mohmp3-empty, so that the stream has somewhere to go. Code: ;
; Music on hold class definitions
;
[classes]
;default => quietmp3:/var/lib/asterisk/mohmp3 ; Plays .mp3 files in sequence from the directory
;default => quietmp3:/var/lib/asterisk/mohmp3-empty,http://www.kcrw.com/pls/kcrwsimulcast.pls ;
default => quietmp3:/var/lib/asterisk/mohmp3-empty,http://pubint.ic.llnwd.net/stream/pubint_wnpr ; WNPR, Norwich, CT
;loud => mp3:/var/lib/asterisk/mohmp3
;random => quietmp3:/var/lib/asterisk/mohmp3,-z
In this instance I am pulling the audio stream from WNPR radio. You can put your favorite URL in its place.
To test Music on Hold I set up a simple exten couplet in [default]. Code: exten => 1098,1,Answer
exten => 1098,2,MusicOnHold()
See if this works for you.
By the way, I plugged the URL into my WinAmp and it worked fine. There's no reason to believe it wouldn't work in Asterisk.
__________________ Please do not send technical questions via PM.
Please post all questions to the forum. | 
August 1st, 2005, 10:55 PM
| | Junior Member | | Join Date: Jun 2005
Posts: 29
| | RE: Problems with Music on Hold Created the empty directory and inserted the default line from your configuration. This did not error but as the sample default entry did for me above I still did not get any music. It did stay connected until the timeout. I'm thinking that the problem is something more basic. I will play with the mpg123 command some from the command line and see if I can get it working there.
In my original configuration I had an empty file (dummy.mp3) in the mohmp3 directory. I did notice that my streaming line was incorrect. It should have been: Code: streaming => custom:/var/lib/asterisk/mohmp3/dummy,/usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.62.253.225:10622/
However this still did not work. Immediate disconnect. This was setup using these instructions: Using Slimserver for Music on Hold (with the exception of the mistake I just found). The URL I have I copied from a WinAmp connection on a Windows machine.
Thanks for the pointers. I post my findings from the command line use of mpg123. | 
August 2nd, 2005, 08:49 PM
| | Junior Member | | Join Date: Aug 2005
Posts: 3
| | Sometimes following the Asterisk source compile the mohmp3 player is not installed properly. Download the mpg123-0.59q-1.i386.rpm file and run it, "rpm -i mpg123-0.59q-1.i386.rpm".
Right after that, you should definately have music on hold | 
August 3rd, 2005, 12:48 AM
| | Junior Member | | Join Date: Jun 2005
Posts: 29
| | Thanks for the rpm suggestion, however, I already have a newer mpg123-0.59r-4.i386.rpm installed. Wonder if I might have better luck compiling and installing from source? Doubt it, since my commnd line tests (below) worked ok.
As for my testing mgp123 from the command line. It worked fine. I took the command portion of my streaming context above: Code: /usr/bin/mpg123 -q -s --mono -r 8000 -f 8192 -b 0 http://64.62.253.225:10622/
and pasted it into a terminal window. That was ugly! Removed the -s (stdout) switch and tried again. Worked fine. A little scratching but the stream played just fine until I stopped it (with a Ctrl-C). Actually it played on for a few seconds after I stopped it.
So now I'm back to why I can't hear it in Asterisk. Any other suggested troubleshooting steps? | 
August 26th, 2005, 05:49 PM
| | Junior Member | | Join Date: Mar 2005
Posts: 21
| | I am almost at the same stage as you were a month ago. Were you able to get your MoH working finally? | 
August 30th, 2005, 06:44 PM
| | Junior Member | | Join Date: Mar 2005
Posts: 21
| | I have a little update on my Music on Hold problem. So it seems that my music on hold is working when I dial in and actually put the call on hold. If I set up an extension with MusicOnHold or WaitMusicOnHold command then I get silence. Here is my extension setup - anything wrong here? Code: exten => 101,1,Answer
exten => 101,2,MusicOnHold(default)
exten => 101,3,Wait(30)
exten => 101,4,Hangup
Thanks | 
August 30th, 2005, 08:01 PM
|  | Senior Member | | Join Date: Aug 2004 Location: USA or Japan
Posts: 5,013
| | Try MusicOnHold() and see if it works.
__________________ Please do not send technical questions via PM.
Please post all questions to the forum. | 
August 30th, 2005, 09:50 PM
| | Junior Member | | Join Date: Mar 2005
Posts: 21
| | Tried that. No joy.
I was able to isolate the problem a little bit further. I have patched my Asterisk 1.0.8 to allow Alert-Info header routing ( see this thread). The routing works fine.
I have a DID with Teliax (IAX2 inbound). I set it up to execute exactly the same sequence as the BV alternate and it works just fine. So it probably is a problem with the patch. The next try is to setup the same commands on the Broadvoice primary and exact same thing for one of my other DIDs (SIP based).
Will report my findings. | 
September 7th, 2005, 02:55 PM
| | Junior Member | | Join Date: Jun 2005
Posts: 29
| | I haven't gotten anywhere else with it. I am in the process of building another Asterisk server. I'll see it that one works any better. |  | | | Thread Tools | | | | Display Modes | Rate This Thread | Linear Mode | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |