Music on Hold broken for anyone else

A little background.

This is a new install on Ubuntu 10.04 Server.
Asterisk Version: 1.6.2
FreePBX Version: 2.8.0

Music on Hold just flat out wasn’t working. I was seeing these entries in /var/log/asterisk/full

The problem looks pretty obvious… there really is no such path as /var/lib/asterisk//mohmp3/don//orig_11 Liver Splash. Instead, it should be “/var/lib/asterisk/mohmp3/don/orig_11 Liver Splash”

The contexts in musiconhold_additional.conf were being written like so


Notice the “//” in the directory?

I edited the following 2 lines in /var/www/html/admin/modules/music/


and in this section

                        } elseif ($tresult != "default" ) {
                                $dir = $path_to_moh_dir."/{$tresult}/";
                        } else {
                                $dir = $path_to_moh_dir.'/';
                        if (file_exists("{$dir}.custom")) {
                                $application = file_get_contents("{$dir}.custom");
                        } else if (file_exists("{$dir}.random")) {

                        } else {

I changed


The directory path is now being written as it should in musiconhold_additional.conf and my music on hold is now working. I’m not sure if that is the best way to handle that or not, but it works. Maybe someone can post a better solution?

Another issue I’m having is with the recordings for my IVR. The recording just doesn’t play. In extensions_additional.conf, the announcements are entered as

If I manually define the full path to the recording, then it works.

Have yet to find where freepbx is writing that path to extensions_additional.conf. If anyone could point me in the right direction there, then I would appreciate it.

oppps yup that was it, I only ran sox -r 8000 on a converted mp3 which left the stereo channel, converted to mono works.

I’m also having the same issue, got the directory issue fixed, but no matter what what i upload I get the following in my log

[2010-10-20 09:53:07] WARNING[9675] res_musiconhold.c: Unable to open file ‘/var/lib/asterisk/mohmp3/test/wav_1’: No such file or directory

but if I do a ls -la on that I see the wav file in that directory

-rw-r–r-- 1 asterisk asterisk 5769588 Oct 20 10:16 /var/lib/asterisk/mohmp3/test/wav_1.wav

Now I could be wrong but notice the asterisk log it’s missing the “wav” extension. Now I’m not a programmer but I did notice that /var/www/html/admin/modules/music/ builds an array of files that have the extension of mp3’,‘MP3’,‘wav’,‘WAV’ as I see on line 167

$extensions = array(‘mp3’,‘MP3’,‘wav’,‘WAV’); // list of extensions to match

I’m leaning towards entering a bug for this. Thoughts?


and you are sure its the right format of wav?

I think should be mohmp3 instead of /mohmp3

I’ve the same ivr MSG=… issue. looking around the code I’ve found the problem:

Freepbx stores in database table recordings the name of file in “filename” field:

mysql> select * from recordings;
| id | displayname | filename | description | fcode | fcode_pass |
| 1 | __invalid | install done | | 0 | NULL |
| 17 | bsivr1wav | custom/bsivr1wav | No long description available | 0 | |
| 18 | bsivr2wav | custom/bsivr2wav | No long description available | 0 | NULL |

that file name is resolved and created by function in freepbx file: modules/recordings/

In particular that matching function is:
function recordings_get_file($id)

but for ivr the MSG generating function is here in modules/ivr/

the solution I’ve found is absolutely not a final bug fix but works.

in modules/ivr/ before line 208 add:

$announcement_msg = “/var/lib/asterisk/sounds/”."$announcement_msg";

attaching path before filename.

Hope this help you.

I recall running into this problem in the past, and I believe that the solution was to simply correct the entires in musiconhold_additional.conf and move on.