Music on hold not working

I finally got sound through all of the devices and working but I have another problem. I have been through a lot of the documentation that is out on the internet on this subject but all of them seemed to go nowhere. I have the musiconhold.conf file setup like this

[defualt]
mode=file
directory=/home/baronobeefdip/Music

and the extensions.conf file has the extension for the music on hold setup like this

[default]
exten => 3,1,Answer()
exten => 3,2,MusicOnHold()

There seems to be nothing wrong with any of theses files as far as syntax goes. I have music files in the directory specified but in mp3 format. I dial the phone when the mode is set to file, however the PBX stays on the line and doesn’t drop the call but I don’t hear any music. I changed it to mp3 it immediately dropped the call, I changed it to files and it still dropped the call. changed it back to just file and I heard nothing. Is there a different port that this operates on. I know now that the sound works but I don’t hear any music when I dial that extension.

I would also like to add that I am using Debian Squeeze and just install asterisk-mp3 and used the same settigs I did above, I am still not hearing anything and I am absolutely sure that there are mp3 files in the directory I have specified. I am using Asterisk 1.6

Spelling of “default”.

MP3 really doesn’t make sense for MOH.

Sorry that was a typo. I have it looking like this now. (the actual file wasn’t mispelled)

[default]
mode=files
directory=/home/baronobeefdip/Music

and here is the full extensions list.

[general]
static=yes
writeprotect=no

[default]
exten => 1001,1,Answer()
exten => 1001,n,Dial(IAX2/1001,20,tm)
exten => 1001,n,MusicOnHold()
exten => 1001,n,Hangup()

exten => 1002,1,Answer()
exten => 1002,n,Dial(IAX2/1002,20,tm)
exten => 1002,n,MusiconHold()
exten => 1002,n,Hangup()


exten => 1,1,Answer()
exten => 1,n,Playback(demo-echotest)
exten => 1,n,Echo()
exten => 1,n,Playback(demo-echodone)
exten => 1,n,Hangup()

exten => 2,1,Answer()
exten => 2,n,Playback(demo-congrats)
exten => 2,n,Hangup()

exten => 3,1,Answer()
exten => 3,2,MusicOnHold()

The misspelling problem didn’t fix anything. Like last time I can call the extension and the machine picks up the call, I can’t hear any music when I dial extension 3, nor do I hear anything when I dial either 1002 or 1001 and put the caller on hold. This is getting really confusing as I am doing nothing wrong based on what I have read in books that were written about asterisk and online. Still nothing seems to be working right now, What could possibly be the problem now?

And I thought in case anyone needs it, here is my iax.conf file

[general]
context = default
encryption = aes128
bindport = 4569
bindaddr = 0.0.0.0
tcpaddr = 0.0.0.0
tcpenable = yes

[1001]
type = friend
callerid = User One <1001>
secret = 1001
host = dynamic
careinvite = no
dtmfmode = rfc2833
mailbox = 1001@default
allow = alaw
allow = ulaw
transport = udp
nat = yes

[1002]
type = friend
callerid = User Two <1002>
secret = 1002
host = dynamic
careinvite = no
dtmfmode = rfc2833
mailbox = 1002@default
allow = ulaw
allow = alaw
transport = udp
nat = yes

If you want to hear MOH when you are trying to reach a peer use the ‘m’ option in your Dial cmd. Your dialplan is wrong.

Yes. You removed important information from the dialplan in your problem statement.

Dial does not exit until hte call completes, and, with default options, the dialplan does not continue after Dial unless the call fails.

PS. If that hadn’t been discovered, you would have been asked for verbose logs.

Can you give Mr an example, I know I have changed some things up drastically because I am trio p troubleshooting which seems to be going no where. Ignore extensions.conf file section I posted because its nor what it looks like right now. For note I want to make an extension that will play music when you dial it, (not disk a phone just play music when you disk that extension and then I’ll move on to other things) at this moment the disk plan looks like this (after adding all of the stuff back)

Exten => 1,1,Answer()
Exten => 1,n,MusicOnHold()

The purpose of this extension is top play music after I call the extension. There wool be no phones ringing it is just supposed top play music after dialing that number. I am aware of the m option and have placed it in all of the extensions that dial to a sip or iax2 device and hear nothing.

verbose logs

What if you try this:

Exten => 1,1,Answer()
Exten => 1,n,Playback(music-file)

In either way, the file you will play in Asterisk MUST in .wav format, so Asterisk doesn’t have to do transcoding every time it plays a file. There is tons of posts on this on the forum, so take a look arround.

Where do the sound file go if they are stated without the directory, I have it in the file that is inside of the /var directory, I tried this once and all I got was stutter so the wav format doesn’t seem ideal for the asterisk playback application.

Asterisk can only play .wav if they are 8kHz, mono, 16 bit, linear. (.WAV can only be played if they are standard rate GSM.)

I guess some of the professional PBX systems out there have that capability as opposed top asterisk. I have beth on hold before where they would play songs from artists like fog hat, pat benetar and AC/DC. These have songs that only sound like songs if they are played at a higher wavelength than something from like Beethoven, Bill Haley, and bobby fuller which I have heard on occasion as well.

You have to use the raw format for higher sampling rates. However most people use phones that sample at 8kHz and use 8 bit companded, or voice only codecs. The PSTN is 8kHz 8 bit companded and mobile phones are 8kHz voice only (GSM will encode music, but not well, as it is based on a vocal tract model).

Where people use more music friendly codecs, it is generally for internal phones used by their top executives.

By raw format, I mean the media stream without the RIFF meta data.