MOH doesnt work

folks, im trying to use the moh module. Apparently im expirencing an issue.

here is my log

Dial(“SIP/101-00000033”, “SIP/100,15,tr”) in new stack
[Jul 6 16:53:09] VERBOSE[22571] netsock.c: == Using SIP RTP TOS bits 184
[Jul 6 16:53:09] VERBOSE[22571] netsock.c: == Using SIP RTP CoS mark 5
[Jul 6 16:53:09] VERBOSE[22571] app_dial.c: – Called 100
[Jul 6 16:53:09] VERBOSE[22571] app_dial.c: – SIP/100-00000034 is ringing
[Jul 6 16:53:10] VERBOSE[22571] app_dial.c: – SIP/100-00000034 answered SIP/101-00000033
[Jul 6 16:53:12] VERBOSE[22571] res_musiconhold.c: – Started music on hold, class ‘test’, on SIP/101-00000033
[Jul 6 16:53:12] WARNING[22571] file.c: File /var/lib/asterisk/moh/test//orig_LetsGo1 does not exist in any format
[Jul 6 16:53:12] WARNING[22571] res_musiconhold.c: Unable to open file ‘/var/lib/asterisk/moh/test//orig_LetsGo1’: No such file or directory

i tried to upload both .wav and .mp3 files, without any “-” or “" in it. seems to add a "” regardless.

i noticed that asterisk things there are 2 slashes before the file name “//orig_LetsGo1” also i dont see an extention name eg".mp3" or “.wav” listed in the log, however in /var/lib/asterisk/moh/test/orig_LetsGo1 has the extention name of .mp3.

any help would be appreciated!
thanks in advance

btw. this is my version of fpbx

FreePBX 2.8.0rc1.3 on 192.168.2.50

What distro are you using? Check that the permissions are correct for /var/lib/asterisk/moh/test and that the directory exists.

how could i have left out that info :-(. asteriskNow 1.6

yes the directory has been created and i can see it with the files inside. thought i was clear about that in my last post!
“however in /var/lib/asterisk/moh/test/orig_LetsGo1 has the extention name of .mp3.”

There is no 1.6 of AsteriskNOW, only 1.5 and 1.7.
I suspect that the distro is missing sox, that program is used to convert from .mp3 to .wav
I can check this later, in the mean time open up a shell and type sox to see if it is found.

sox is on 1.7.

However, mpg123 is not and is needed to convert mp3 files.

So it looks like it’s probably a bug in AsteriskNOW that needs to be addressed. You may want to file a report with them.

[root@localhost ~]# sox
sox: Usage: [ gopts ] [ fopts ] ifile [ fopts ] ofile [ effect [ effopts ] ]
Failed: Not enough input or output filenames specified

[root@localhost ~]# mpg123
-bash: mpg123: command not found

if sox or mpg123 is not installed, maybe someone could possibly post me a link with instructions on how to install it properly?

mach appreciated
gavimobile

I believe the dag repository has mpg123 and it’s likely available elsewhere as well.

But go ahead and report the bug to the AsteriskNOW folks on Digium’s tracker as they will want to fix that.

you need to reload the music file.

FreePBX converts the mp3 file to a wav file when it is downloaded but if mpg123 was not there, then that will not have happened.

thanks for your fast reponse p_lindheimer,
i have installed mpg123 from the dag repositories,

same problem. heres my output
[Jul 7 11:00:18] VERBOSE[25173] netsock.c: == Using SIP RTP TOS bits 184
[Jul 7 11:00:18] VERBOSE[25173] netsock.c: == Using SIP RTP CoS mark 5
[Jul 7 11:00:18] VERBOSE[25173] app_dial.c: – Called 100
[Jul 7 11:00:18] VERBOSE[25173] app_dial.c: – SIP/100-00000038 is ringing
[Jul 7 11:00:19] VERBOSE[25173] app_dial.c: – SIP/100-00000038 answered SIP/101-00000037
[Jul 7 11:00:20] VERBOSE[25173] res_musiconhold.c: – Started music on hold, class ‘test’, on SIP/101-00000037
[Jul 7 11:00:20] WARNING[25173] file.c: File /var/lib/asterisk/moh/test//orig_LetsGo1 does not exist in any format
[Jul 7 11:00:20] WARNING[25173] res_musiconhold.c: Unable to open file ‘/var/lib/asterisk/moh/test//orig_LetsGo1’: No such file or directory
[Jul 7 11:00:20] VERBOSE[25173] res_musiconhold.c: – Stopped music on hold on SIP/101-00000037
[Jul 7 11:00:25] VERBOSE[25175] manager.c: == Manager ‘admin’ logged on from 127.0.0.1

output
[root@localhost Downloads]# mpg123
You made some mistake in program usage… let me briefly remind you:

High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
version 1.12.2; written and copyright by Michael Hipp and others
free software (LGPL/GPL) without any warranty but with best wishes

usage: mpg123 [option(s)] [file(s) | URL(s) | -]
supported options [defaults in brackets]:
-v increase verbosity level -q quiet (don’t print title)
-t testmode (no output) -s write to stdout
-w write Output as WAV file
-k n skip first n frames [0] -n n decode only n frames [all]
-c check range violations -y DISABLE resync on errors
-b n output buffer: n Kbytes [0] -f n change scalefactor [32768]
-r n set/force samplerate [auto]
-os,-ol,-oh output to built-in speaker,line-out connector,headphones
-a d set audio device
-2 downsample 1:2 (22 kHz) -4 downsample 1:4 (11 kHz)
-d n play every n’th frame only -h n play every frame n times
-0 decode channel 0 (left) only -1 decode channel 1 (right) only
-m mix both channels (mono) -p p use HTTP proxy p [$HTTP_PROXY]
-@ f read filenames/URLs from f -T get realtime priority
-z shuffle play (with wildcards) -Z random play
-u a HTTP authentication string -E f Equalizer, data from file
-C enable control keys --no-gapless not skip junk/padding in mp3s
-? this help --version print name + version
See the manpage mpg123(1) or call mpg123 with --longhelp for more parameters and information.
[root@localhost Downloads]#

yea dood, of course i re-uploaded the music file to test. i also deleted the old ones which weren’t successful. i dont remember if i restarted amportal or not but tomorrow i will restart my server just in case. are there any other suggestions?

again in the link to the file there are 2 forward slashes.
"Unable to open file ‘/var/lib/asterisk/moh/test//orig_LetsGo1’: "

is that normal?
also just a note, the default music that was working, just my custom music isnt.

waiting eagerly for your responses

it sounds like it may not have successfully transcoded your mp3 file.

Take a look in the directory and see if there is a proper “.wav” file present from the transcoding.

i uploaded a wav file when i did my test after i installed mpg123 not a mp3.
is that extra slash normal?
also when u say “in the account” where are u referring to.
i am not as experienced as you please bare with me and be a bit more detailed!
thanks in advance

sorry typo, I meant in the directory.

the extra slash is not an issue.

Make sure if you uploaded a wav file directly that it is in a format that Asterisk can understand.

so is it best to upload a mp3 and relax while mpg123 does the conversion for me?

since most music is in mp3 format, it’s usually easier and FreePBX will make sure to apply the proper format settings during the conversion.

works like a charm buddy!!! thanks alot!

Hello I am having same issues here.

This is my First attempt at adding any new files to the MOH function within of FREEPBX GUI

What Format or where can I find how the .wav files I import will work with asterisk and FREEPbx as it stands. Customer emails me a .wav or file what am I to do so I can just upload via GUI

Im using Beta Distro 1.1100.211.63-5

I had this same issue before on 2.9 but I just never went back to it i guess. Now Im trying to learn how to do this and am a little lost when uploading .wavs

Thanks in advance hopefully after January’s training I wont have these silly issues.

I got it working

Sorry a little more reading on my part and you guys in this wonderful community have laid it out for us thanks again in advance

had to read the bible kinda again and found my answer i needed.

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/additional_configuration_tasks-musiconhold-conf-file.html