MOH not working

when moh should start, I do hear music for about a quarter of a second and then silence. This was happening before I recreated the musiconhold.conf as well as after. And, I only have one .wav file in the mohwav directory and it is not music, it is just the sound of crickets. So, that quarter of a second of music is coming from somewhere else. Not sure where to go from here. thx.

[Aug 25 19:55:57] VERBOSE[3234] logger.c: – Started music on hold, class ‘default’, on SIP/01158251-b7d02088
[Aug 25 19:55:57] WARNING[3234] format_wav.c: Not in mono 2
[Aug 25 19:55:57] WARNING[3234] file.c: Unable to open format wav
[Aug 25 19:55:57] WARNING[3234] res_musiconhold.c: Unable to open file ‘/var/lib/asterisk/mohwav/420__TicTacShutUp__crickets’: No such file or directory
[Aug 25 19:55:57] VERBOSE[3234] logger.c: – Stopped music on hold on SIP/01158251-b7d02088

I have confirmed the file is there and permissions are set appropriately. So, perhaps it is the ‘Unable to open format wav’ that is the problem (?) Other vmail wav files play fine. thanks.

I downloaded asterisk-moh-freeplay-wav.tar.gz from http://downloads.asterisk.org/pub/telephony/sounds/ and untarred it into /var/lib/asterisk/moh directory, did a ‘moh reload’ at CLI> and it is working.
So, bottom line is my custom wav file was in the wrong format even though I converted it to 8khz, mono, 16-bit with ‘Ease Audio Converter’.

There appears to be an issue with the default setup of MOH on FreePBX.
Here’s what I had to do to resolve it.

  1. Created /var/lib/asterisk/mohmp3 directory
  2. Copied *.ulaw files from /var/lib/asterisk/moh to new mohmp3 directory
  3. Reloaded asterisk

Remove the text files from the moh directory. Not the ‘.*’ files but the 3 text files. One is a license file and the other 2 can’t remember.

I had this problem and it turns out MOH is trying to play the text files so you get intermittent silence and CLI show MOH stopping. This is a confirmed bug but I cannot find the Asterisk bug report right now.

I upgraded to 1.4.27 and my moh from phone to phone stopped working. It works when i call into a queue, and from trunks just nor phone to phone. According to the cli it does not even look like it tries.

Asterisk 1.4.27, Copyright © 1999 - 2008 Digium, Inc. and others.
Created by Mark Spencer [email protected]
Asterisk comes with ABSOLUTELY NO WARRANTY; type ‘core show warranty’ for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type ‘core show license’ for details.

== Parsing ‘/etc/asterisk/asterisk.conf’: Found
Connected to Asterisk 1.4.27 currently running on localhost (pid = 2274)
Verbosity was 3 and is now 8
– Registered SIP ‘3390’ at 10.10.10.52 port 5060
– Saved useragent “Aastra 55i/2.5.2.1010” for peer 3390
– Executing [3301@from-internal:1] Macro(“SIP/3303-00000000”, “exten-vm|3301|3301”) in new stack
– Executing [s@macro-exten-vm:1] Macro(“SIP/3303-00000000”, “user-callerid”) in new stack
– Executing [s@macro-user-callerid:1] Set(“SIP/3303-00000000”, “AMPUSER=3303”) in new stack
– Executing [s@macro-user-callerid:2] GotoIf(“SIP/3303-00000000”, “0?report”) in new stack
– Executing [s@macro-user-callerid:3] ExecIf(“SIP/3303-00000000”, “1|Set|REALCALLERIDNUM=3303”) in new stack
– Executing [s@macro-user-callerid:4] Set(“SIP/3303-00000000”, “AMPUSER=3303”) in new stack
– Executing [s@macro-user-callerid:5] Set(“SIP/3303-00000000”, “AMPUSERCIDNAME=Admissions 3303”) in new stack
– Executing [s@macro-user-callerid:6] GotoIf(“SIP/3303-00000000”, “0?report”) in new stack
– Executing [s@macro-user-callerid:7] Set(“SIP/3303-00000000”, “AMPUSERCID=3303”) in new stack
– Executing [s@macro-user-callerid:8] Set(“SIP/3303-00000000”, “CALLERID(all)=“Admissions 3303” <3303>”) in new stack
– Executing [s@macro-user-callerid:9] GotoIf(“SIP/3303-00000000”, “0?continue”) in new stack
– Executing [s@macro-user-callerid:10] Set(“SIP/3303-00000000”, “__TTL=64”) in new stack
– Executing [s@macro-user-callerid:11] GotoIf(“SIP/3303-00000000”, “1?continue”) in new stack
– Goto (macro-user-callerid,s,18)
– Executing [s@macro-user-callerid:18] NoOp(“SIP/3303-00000000”, “Using CallerID “Admissions 3303” <3303>”) in new stack
– Executing [s@macro-exten-vm:2] Set(“SIP/3303-00000000”, “RingGroupMethod=none”) in new stack
– Executing [s@macro-exten-vm:3] Set(“SIP/3303-00000000”, “VMBOX=3301”) in new stack
– Executing [s@macro-exten-vm:4] Set(“SIP/3303-00000000”, “EXTTOCALL=3301”) in new stack
– Executing [s@macro-exten-vm:5] Set(“SIP/3303-00000000”, “CFUEXT=”) in new stack
– Executing [s@macro-exten-vm:6] Set(“SIP/3303-00000000”, “CFBEXT=”) in new stack
– Executing [s@macro-exten-vm:7] Set(“SIP/3303-00000000”, “RT=15”) in new stack
– Executing [s@macro-exten-vm:8] Macro(“SIP/3303-00000000”, “record-enable|3301|IN”) in new stack
– Executing [s@macro-record-enable:1] GotoIf(“SIP/3303-00000000”, “1?check”) in new stack
– Goto (macro-record-enable,s,4)
– Executing [s@macro-record-enable:4] AGI(“SIP/3303-00000000”, “recordingcheck|20091122-011931|1258870771.0”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck|20091122-011931|1258870771.0: Inbound recording enabled.
recordingcheck|20091122-011931|1258870771.0: CALLFILENAME=20091122-011931-1258870771.0
– AGI Script recordingcheck completed, returning 0
– Executing [s@macro-record-enable:999] MixMonitor(“SIP/3303-00000000”, “20091122-011931-1258870771.0.wav||”) in new stack
– Executing [s@macro-exten-vm:9] Macro(“SIP/3303-00000000”, “dial|15|trWw|3301”) in new stack
– Executing [s@macro-dial:1] GotoIf(“SIP/3303-00000000”, “1?dial”) in new stack
– Goto (macro-dial,s,3)
– Executing [s@macro-dial:3] AGI(“SIP/3303-00000000”, “dialparties.agi”) in new stack
– Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
== Begin MixMonitor Recording SIP/3303-00000000
dialparties.agi: Starting New Dialparties.agi
== Parsing ‘/etc/asterisk/manager.conf’: Found
== Parsing ‘/etc/asterisk/manager_additional.conf’: Found
== Parsing ‘/etc/asterisk/manager_custom.conf’: Found
== Manager ‘admin’ logged on from 127.0.0.1
dialparties.agi: Caller ID name is ‘Admissions 3303’ number is '3303’
dialparties.agi: USE_CONFIRMATION: 'FALSE’
dialparties.agi: RINGGROUP_INDEX: ''
dialparties.agi: Methodology of ring is ‘none’
– dialparties.agi: Added extension 3301 to extension map
– dialparties.agi: Extension 3301 cf is disabled
– dialparties.agi: Extension 3301 do not disturb is disabled
> dialparties.agi: extnum 3301 has: cw: 1; hascfb: 0 [] hascfu: 0 []
dialparties.agi: ExtensionState: 0
– dialparties.agi: dbset CALLTRACE/3301 to 3303
– dialparties.agi: Filtered ARG3: 3301
== Manager ‘admin’ logged off from 127.0.0.1
– AGI Script dialparties.agi completed, returning 0
– Executing [s@macro-dial:7] Dial(“SIP/3303-00000000”, “SIP/3301|15|trWw”) in new stack
– Called 3301
– SIP/3301-00000001 is ringing
– SIP/3301-00000001 answered SIP/3303-00000000
– Registered SIP ‘3390’ at 10.10.10.51 port 5060
– Saved useragent “Aastra 6731i/2.5.2.1010” for peer 3390
– Executing [h@macro-dial:1] Macro(“SIP/3303-00000000”, “hangupcall”) in new stack
– Executing [s@macro-hangupcall:1] GotoIf(“SIP/3303-00000000”, “1?skiprg”) in new stack
– Goto (macro-hangupcall,s,4)
– Executing [s@macro-hangupcall:4] GotoIf(“SIP/3303-00000000”, “1?skipblkvm”) in new stack
– Goto (macro-hangupcall,s,7)
– Executing [s@macro-hangupcall:7] GotoIf(“SIP/3303-00000000”, “1?theend”) in new stack
– Goto (macro-hangupcall,s,9)
– Executing [s@macro-hangupcall:9] Hangup(“SIP/3303-00000000”, “”) in new stack
== Spawn extension (macro-hangupcall, s, 9) exited non-zero on ‘SIP/3303-00000000’ in macro ‘hangupcall’
== Spawn h extension (macro-dial, h, 1) exited non-zero on ‘SIP/3303-00000000’
== Spawn extension (macro-dial, s, 7) exited non-zero on ‘SIP/3303-00000000’ in macro ‘dial’
== Spawn extension (macro-exten-vm, s, 9) exited non-zero on ‘SIP/3303-00000000’ in macro ‘exten-vm’
== Spawn extension (from-internal, 3301, 1) exited non-zero on ‘SIP/3303-00000000’
== MixMonitor close filestream
== End MixMonitor Recording SIP/3303-00000000
– Registered SIP ‘3390’ at 10.10.10.52 port 5060
– Saved useragent “Aastra 55i/2.5.2.1010” for peer 3390
– Registered SIP ‘3390’ at 10.10.10.51 port 5060
– Saved useragent “Aastra 6731i/2.5.2.1010” for peer 3390
– Registered SIP ‘3390’ at 10.10.10.52 port 5060
– Saved useragent “Aastra 55i/2.5.2.1010” for peer 3390
localhost*CLI>

I’m using Asterisk 1.4 & FreePBX 2.5.0.1 . When I upload music file via web to run MOH function , A error message appear:
Error Processing: “sox: Can’t open input file ‘/var/lib/asterisk/mohmp3/orig_agent-alreadyon.wav’: No such file or directory
sox: Can’t open input file ‘/var/lib/asterisk/mohmp3/orig_agent-alreadyon.wav’: No such file or directory” for agent-alreadyon.ulaw!
This is not a fatal error, your Music on Hold may still work.

Note that I converted music file to .mp3 with 8000 MHz . But MOH function still run OK with file .ulaw existed in local system , just can’t upload new music file.
Pls give me advise

I have MOH working fine between extensions on one machine after upgrading it to 2.6.0.0
When I place an extension on hold after answring the call, the log shows a line like:

[Dec 29 11:56:15] VERBOSE[13444] logger.c: – Started music on hold, class ‘default’, on SIP/206-09133730

but I then built another machine and upgraded and it simply won’t play the music-on-hold. As per CCIE21241’s post above, the system doesn’t even try to invoke MOH.

[2009-12-29 12:45:30] VERBOSE[3061] app_dial.c: – SIP/208-00000003 is ringing
[2009-12-29 12:45:31] VERBOSE[3061] app_dial.c: – SIP/208-00000003 answered SIP/210-00000002

then nothing further in the asterisk log till I hang up; no mention of music on hold in the log.

Anyone had this and resolved it?

Don’t use ‘_’ or ‘-’ in the filename.

When I place a call on hold using X-Lite, I get music, but when I use my Aastra phone it doesn’t even request it, and the held call gets dropped.

DON’T hijack a thread with a totally different question. Create a new thread instead.

This worked for me…looks like the module is very unforgiving with the WAV sampling…

I thought it accepted mp3 files, I guess not.

I am not convinced that these two problems are completely isolated. Therefore, I posted my observation to the mix, in the hope of getting to the bottom of both issues. I renamed all my files to eliminate spaces, ‘_’ and ‘-’, and still am unable to play anything but the default .wav files. Further, I’ve tried both .mp3 and .wav files, and conversions between the two, to no avail.

I will also start another thread with the Aastra phone issue.

Just some background on my setup:

CeNTOS 5.5 x86_64
Asterisk Ver 1.6.2.11
FreePBX ver 2.8.0.2

What I found was more or less the path statements for mpg123 were not working when FreePBX tried to call it and convert an MP3 to wav.

In the file /var/www/admin/modules/music/page.music.php

I had to change the lines that call mpg123 to include the path to the binary file, for example:

$mpg123cmd = "mpg123…

Had to be changed to:

$mpg123cmd = "/usr/local/bin/mpg123…

Please note that is not the complete line, there is some variable information that comes after that which should not be deleted.

Once I made that change MoH worked fine in all circumstances. It may be worth the time for the devs to add an extra variable as part of the config script that asks where mpg123 is installed if needed.

There’s also supposed to be lame support, and the same fix would need to be applied to it’s execution call as well, because I did have it working with lame as well, but it was choppy. mpg123 was more stable.

I can’t take complete credit for this, I found this solution on another forum, but can’t find the link at the moment, but wanted to pass this along in case it helped someone else.

Hey everyone:

Using a mix of suggestions here and trail-and-error, I was able to make FreePBX play MOH using any MP3… but it wasn’t easy.

First, I had to run the MP3 through a conversion to change it to an OGG file (I used Ease Audio Converter). Then I posted the file to my own webspace.

This set up a scenario exactly like that mentioned earlier by arlasnkur.

I then used WGET to transfer the OGG file from the web site to the server, then used sox to convert it to WAV. I made sure to name the file something simple (moh1, for example).

It is THE ONLY WAY I could get the thing to work!

After many, many, many days of reading and trial and error intents I finally figured out a way (that works) to properly format music files and upload them to my FreePBX successfuly!!!
I created a tutorial to share with you all. Hope this end many headaches… I know it ended mine.

You can do all of that in the video or you can simply install sox on your system so FreePBX does it automatically!