Music on Hold (MOH) upload problem

Arch = x86_64
OS = CentOS-6.4 (freepbx)
Asterisk = 11.4.0
FreePBX = 2.11.0.2

I uploaded some licensed music .wav files using the FreePBX MOH settings module into the ‘default’ category. However, when a call is placed on hold I see this in asterisk (replace file name with each uploaded file):

2013-06-19 09:10:33] WARNING[21514][C-00000024]: res_musiconhold.c:343 ast_moh_files_next: Unable to open file ‘/var/lib/asterisk/moh//wav_UnderTheMoon’: No such file or directory

What appears to happen is that although the file uploaded was named ‘UnderTheMoon.wav’ FreePBX/Asterisk renamed this on upload to wav_UnderTheMoon.wav and then evidently looks for wav_UnderTheMoon when it tries to use it, which is quite confusing.

Is there some step that I am missing here?

On a related matter, why is there no way to copy or move music from one category to another rather than having to upload and delete files repeatedly?

The essential problem is that the files that I obtained were recorded with frequency range beyond what asterisk will accept and it simply refused to load them. Evidently when this occurs there exists some sort of fall-back code which is used to search for a similarly named file without the .wav extension and in its absence the misleading missing file error message is generated.

So that the next poor soul that runs into this difficulty just might run across this message the technique that I used to convert the files was this:

  1. Install sox (base) and mpg123 (rpmforge). These are already included in the FreePBX disto if you do the conversions on the Asterisk host.

  2. Convert all sound files to .wav if not already in that format:

for OPUS in $(ls *ogg); do sox $OPUS -S -c1 -s $OPUS.wav; rename .ogg.wav .wav $OPUS.wav ; done for OPUS in $(ls *mp3); do mpg123 -w $OPUS.wav $OPUS; rename .mp3.wav .wav $OPUS.wav ; done
  1. Convert the .wav files to monaural (-c1) 8000Hz (-r8000) recordings renaming them with the prefix r8000_:
for OPUS in $(ls *wav); do sox $OPUS -r8000 -S -c1 -s r8000_$OPUS; done
  1. Remove any unusable audio files already present anywhere in the /var/lib/asterisk/moh tree. Otherwise you will continue to get errors.

  2. Move the converted r8000_* files into the moh directory or sub-directory:

mkdir /var/lib/asterisk/moh/classical mv r8000_* /var/lib/asterisk/moh/classical chown -R asterisk: /var/lib/asterisk/moh/classical
  1. Set the moh category on your inbound routes to the moh subdirectory used to store the audio files (‘classical’ in the example above) or to ‘default’ if you placed all the converted files directly into /var/lib/asterisk/moh.

  2. Unload and reload music on hold module:

asterisk -r -x 'module reload res_musiconhold.so'

Things should now work.

I have no idea what, besides uploading, the FreePBX moh module does or is supposed to do but, it turns out to be far easier to just handle all this at the command line.