MOH - problem with mp3

Hi, in my last freepbx installation i have a brand new problem (fpbx last release as today)

if i upload an mp3 i have:

Error Processing: “sox failed to convert file and original could not be copied as a fall back” for prelude01.mp3!

file seems to be loaded, but … if i try to use it nothing is played and on log i have:

WARNING[14197] file.c: File /var/lib/asterisk//mohmp3//orig_01-suite-prelude does not exist in any format
WARNING[14197] res_musiconhold.c: Unable to open file ‘/var/lib/asterisk//mohmp3//orig_01-suite-prelude’: No such file or directory

obiouvsly file is there!

If i try using the default .ulaw file it works …

I am also observing the same problem.

Anyone have a fix for this yet?
Error Processing: “sox failed to convert file and original could not be copied as a fall back”

downloaded asterisk now then upgraded all modules.
MOH doesnt work… running all updates.
FreePBX 2.7.0.1

I ended up working around the problem by converting the mp3 files to .wav files that are encoded as 8Kbit/sec, mono, 16bits PCM and then uploading the wav file instead of the mp3 file.

You also need to first create the directory /var/lib/asterisk/mohmp3/ and chown and chgrp to asterisk (and mode 775). This is the diretory wher FreePBX tries to store the file and it is not created in the freebpx installation process.

Hi,

I tried to upload a .wav but I still get:

Error Processing: “sox failed to convert file and original could not be copied as a fall back” for simple.wav!
This is not a fatal error, your Music on Hold may still work.

I figured could be due to a upload limitation in php.ini so I changed the upload configuration to:

; Maximum allowed size for uploaded files.
upload_max_filesize = 20M

That didn’t do it… kinda stuck. I installed my freepbx 2.7.0.1 using Yum on Centos 5.4 so I’m wondering if my build didn’t include/compile/install the MOH conversion setting properly… Any ideas would be much appreciated

Is your .wav file in the correct format? There is no conversion needed if the .wav file is 8Kbit/sec, 16 bits, mono, Microsoft PCM format. A stereo wav file ripped from a CD will not work.

Thanks for the quick reply daled. The format is PCM 8.000 kHz, 16 Bit, Mono. I still got the error for a while.

I noticed were able to get warning messages… I installed the log modules but everytime I viewed it in the gui I could only scroll a few thousand lines and can’t find any warnings like the ones you put above…

I looked directly for the log and found…

[Apr 16 02:30:38] WARNING[14503] res_musiconhold.c: Cannot open dir /var/lib/asterisk/moh/ or dir does not exist
[Apr 16 02:30:38] WARNING[14503] res_musiconhold.c: Cannot open dir /var/lib/asterisk/moh/.nomusic_reserved or dir does not exist

I created mohmp3 instead of moh… doh! thanks a bunch!

I tried to file a bug, because this used to work fine before I upgraded the core, this was the response I got on the bug tracker. Anyone know how to do this?

change apache to run as user asterisk

changing apache to run as user asterisk does not fix the problem. There are at least two problems in the ISO distribution: the 1) mohmp3 directory does not exist and 2) even when apache is running as asterisk the sox error still occurs. There is something fundamentally wrong with the mp3 converson in the freebpx ISO.

By the way to change the apache user:

cd /etc/httpd/conf

cp httpd.conf httpd.conf.orig

vi httpd.conf

Find the line User apache and change it to User asterisk. Save the file and exit.

service httpd restart

thanks!
It’s interesting because I have used this ISO before and just had to create the mohmp3 folder and correct the permissions, I have never seen this error before.
I suspect it’s related to:
the only things that have changes since it stopped working was I upgraded the core to 2.7 and i used the 64 bit iso.
before I was on the 32 bit iso and 2.6 modules.
anyone else with same error on 2.7 or 2.6 and are you using the 64bit or 32bit?

Thanks!

same problem, i was using 2.7 and 64bit, i am running 2.8 now and still the same problem

I loaded the 32 bit ISO (in a VM for testing) and its not an issue - its only with the 64 bit.
Of course you have to do this:
chown -vR asterisk.asterisk /var/lib/asterisk/mohmp3
chmod -v 775 /var/lib/asterisk/mohmp3
chmod -v 664 /var/lib/asterisk/mohmp3/*
In case you still want to use web interface and plan to upload larger mp3 music on hold files, change the “max filesize” from 2M to 20M in
nano /etc/php.ini

But then it works fine, it seems to be an issue on he 64 bit only.

Still have the same problem after doing everything you’ve suggested

Error Processing: “sox failed to convert file and original could not be copied as a fall back” for 14 Notte A Sorpresa.mp3!

I had the same problem, ( I had upgraded free pbx, but not with complete ISO).
I followed the trails of the php that uploads the files and found out that it
is trying to use mpg123 program in order to convert the mp3 into a wav.

the only reason to do that is because the sox that is on the system was complied out with no support for mp3 format.

  1. I searched for mpg123 software on my system and i did not have it.

takeing the source of mpg123, compiling it on my system solved the mp3 problem.

  1. You can complile the sox to support mp3, and then convert directly to wav,
    I belive this will requiere to change the php that handles the upload but it is really str8 forward…

Hope this helps…

I too had the same issue.

cat /etc/asterisk/musiconhold_additional.conf
[default]
mode=files
directory=/var/lib/asterisk/moh/
random=yes
[none]
mode=files
directory=/var/lib/asterisk/moh/.nomusic_reserved

I saw that the file was trying to access directory=/var/lib/asterisk/moh/ which did not exist on my box after the upgrade

I only had mohmp3.

Since the _additional.conf file was changing upon reload I just stopped amportal, renamed my /var/lib/asterisk/mohmp3 to /var/lib/asterisk/moh, restarted amportal and it fired right up.

I didnt feel comfortable enough to change the php.

Hope this helps

Charles thanks for tip mymusiconhold_additional.conf file was missing
this line

directory=/var/lib/asterisk/moh/

Put it back in and all good.

Thanks for this tip. Was having issue uploading WAV files on a brand new 32bit install and this fixed the issue.

mymusiconhold_additional.conf file was missing
this line

directory=/var/lib/asterisk/moh/

Put it back in and all good.

Good Evening,
I hate to reopen a thread.

I have tried all of the above and anything I can find but can not full resolve this issue. I even installed the 32bit ISO (AsteriskNOW) and set it up today.

I now am able to upload most file and can see them and everything looks happy. But it will not play them when I place someone on hold.

Any assistance would be great

Thanks

Andrew

Hey Andrew, you may be missing the ‘mpg123’ package. My guess is that due to the possibility of a patent infringement or any other commercial bul…it this package was intentionally left out from AsteriskNOW by Digium. Shamefully, this limitation was not documented (at least i could not find anything!).

Log in your pbx via ssh and issue the ‘mpg123’ command, if the command is not there, then just add the RPM Forge repository and install the ‘mpg123’ packages and its dependencies using yum.

After doing that, any mp3 file that is submitted using the FreePBX interface gets instantly converted to wav.

Good luck!