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


[default]
mode=files
directory=/var/lib/asterisk//mohmp3/
[don]
mode=files
directory=/var/lib/asterisk//mohmp3/don/
[none]
mode=files
directory=/var/lib/asterisk//mohmp3/.nomusic_reserved

Notice the “//” in the directory?

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

to

and in this section

       touch($dir."/silence.wav");
                        } 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");
                                $File_Write.="[{$tresult}]\nmode=custom\napplication=$application\n";
                        } else if (file_exists("{$dir}.random")) {
                                

$File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}\nrandom=yes\n";
                        } else {
                                $File_Write.="[{$tresult}]\nmode=files\ndirectory={$dir}\n";
                        }
                }
        }

I changed

to

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/page.music.php 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?

Cheers,
Eric

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

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/functions.inc.php

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

but for ivr the MSG generating function is here in modules/ivr/functions.inc.php

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

in modules/ivr/functions.inc.php before line 208 add:

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

attaching path before filename.

Hope this help you.
Andrea

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.