Music on hold, don't hear anything

Hi,

I am trying to get music on hold working on asterisk 1.2. But I simply don’t hear anything when I call my number. Here are my configs. Does anyone know what I am doing wrong?

Thanks in advance!

extensions.conf:
exten => s,1,Answer()
exten => s,2,SetMusicOnHold(default)
exten => s,3,Dial(SIP/${ARG1},20,m)

musiconhold.conf:
[default]
mode=quietmp3
directory=/var/lib/asterisk/mohmp3
application=/usr/bin/mpg123 -q -r 8000 -f 8192 -b 2048 --mono -s

Maybe you use the wrong version of mpg123 . You need the proper version (mpg123 0.59r )

Maybe the sound files are not owned by asterisk but by root. This way it won’t work.

Maybe the sample rate of the files isn’t correct. (single channel (mono) raw stream with 8000Hz sample rate)

Maybe you didn’tdefine the classes in a proper way in musiconhold.conf. An example is:

[classes]
default => quietmp3:/usr/share/asterisk/mohmp3

If you paste some cli output to the forum it will be much more easier to give more spciific answers.

With friendly regards,

Erik de Wild
Voop

It might sound pretty easy, first of all I am running Asterisk 1.2.9.1, it is not necessary to install any mp3 player of any kind on asterisk as there is already one in-built, the solution to everyone’s default moh issues might just be the last / at the end of the directory line in musiconhold.conf . For example;

musiconhold.conf:

[default]
mode=files
directory=/var/lib/asterisk/mohmp3/ [size=75]<—it needs the ‘/’ at end of this line[/size]
random=yes

By default the “directory=/var/lib/asterisk/mohmp3” line does not come with the “/” at the end of the line, so once the / is added at the end of that line the default moh/mp3 files should work fine. The above is all that’s needed in musiconhold.conf to enable default moh (just copy and paste or modify your default settings in musiconhold.conf to match. Make sure to run “reload” on asterisk after any config modification to take effect. And to be clear, no “SetMusicOnHold=default” was set in extensions.conf since asterisk will seek this default setting anyway if not specified otherwise. This configuration can be applied to other classes by just changing the context from [default] to [moh-native] for example. The audio file path can also be changed as long as the / is added to the end of the path, for example; directory=/usr/local/share/asterisk/moh/
Using “mode=files” gives the advantage of appropriately transcoding whatever sound files into the audio format used in transmitting the current call, and “random=yes” enables randomization of sound files being played.

NOTE: Whatever directroy the “directory=” line points to should have the “/” at the end of it or else it might not work.

My apologies to intrude into your thread. I am also having same problem and unable to resolve it. I followed the “/” thing on musiconhold.conf file. below is my debug output. please someone help me to resolve this.


-- Executing Macro("SIP/2138-b7905290", "ext|SIP/3138|3138") in new stack
-- Executing Answer("SIP/2138-b7905290", "") in new stack
-- Executing SetMusicOnHold("SIP/2138-b7905290", "default") in new stack
-- Executing Dial("SIP/2138-b7905290", "SIP/3138|15") in new stack
-- Called 3138
-- SIP/3138-09e79678 is ringing
-- SIP/3138-09e79678 answered SIP/2138-b7905290
-- Attempting native bridge of SIP/2138-b7905290 and SIP/3138-09e79678
-- Started music on hold, class 'default', on channel 'SIP/2138-b7905290'
-- Stopped music on hold on SIP/2138-b7905290

== Spawn extension (macro-ext, s, 3) exited non-zero on ‘SIP/2138-b7905290’ in macro ‘ext’
== Spawn extension (macro-ext, s, 3) exited non-zero on ‘SIP/2138-b7905290’


extensions.conf (portion of the file)

[macro-ext]
exten => s,1,Answer
exten => s,2,SetMusicOnHold(default)
exten => s,3,Dial(${ARG1},15)
exten => s,4,Voicemail(u${ARG2})
exten => s,5,Hangup

musiconhold.conf

[default]
mode=files
directory=/var/lib/asterisk/mohmp3/
random=yes

From Asterisk 1.2 or above, asterisk supports MOH natively. For MOH to work natively, you must install asterisk-addon package which has the format_mp3.so module. Load it in modules.conf. It should work.

Refer this link:- voip-info.org/wiki-Asterisk+ … nhold.conf. It has all information.

I head banged much for this prob too unless i read some where that your zapata.conf must have this line [color=blue]musiconhold=default[/color] (if your sys involves zap side too), after i did that, MOH started workin

I hope it may work for u too

Hi delusion,

MOH WORKING !!!

Thanks a lot for your suggestion. It really helped me.

Thanks
Sekhar.

you are welcome

I just had a similar problem, none of the fixes above solved the issue.

I had installed the add-ons, confirmed it was loading format_mp3, checked the folders, put references to the music context everywhere I could think… still nothing. It simply showed the music starting then immediately stopping again.

In the end I had a hunt around and found the “modules.conf” file had a reference that explicitly loaded the music on hold, for no reason that I could see as autoload was set to yes. I commented out the line and restarted Asterisk - it started working straight away.

Any ideas why this is the case?

Mike

I had much trouble setting up MOH also trying to use mpg123. I found it was much easier to install the add-ons package which will then allow you to use the native * player. You will need to set the mode=files in your musiconhold.conf. Once I did this, MOH was working playing all my favorite jazz mp3’s to anyone on hold.

Take my advice…use the add-ons and forget about mpg123 with *.

truer words have never been spoken. our uptime went up drastically after dropping mpg123…i can’t imagine having to go back to that…

Maxfiles,

Do you have any guide on how to install native * player? I’m a newbie. walkthrough please… :smile:

Is it possible to use format_mp3 from addons with a mp3 http stream ?
It always launches mpg123, and I have a very very loud and crapy sound for a few days.
My conf :

[test0] mode => quietmp3 directory => /var/lib/asterisk/mohmp3-empty/ application => http://stream.novazur.fr:8000/.mp3

(don’t try it, that’s just an internal stream, and don’t care about “.mp3”, it’s ok)

Thanks a lot.

It was a mpg123 version problem.
downgrading from (gentoo) media-sound/mpg123-0.65 to media-sound/mpg123-0.59s-r11 solved it.

I have a similar problem.

Asterisk version: 1.4.2
I have 3 SIP client in lan and 1 carrier with geografic number connected to the asterisk PBX. I use the G.729 codec for the carrier.

When someone call to geografic number, the incoming call is redirect to a queue named 201.
If an internal client call the queue 201 i can hear music (the default files wav included in Asterisk 1.4.2 package), but if someone call to geografic number the guest don’t hear nothing until someone answer to his call.
How is possible?

This is my configuration:
3 SIP client have local number: 200, 202, 203
Queue number is: 201

musiconhold.conf

[default]
mode=files
directory=/var/lib/asterisk/moh/

queue.conf


[201]
strategy = ringall
timeout = 15
wrapuptime = 15
autofill = yes
autopause = no
maxlen =0
joinempty = no
leavewhenempty = no
reportholdtime = no
musiconhold = default
musicclass = default
member = SIP/200
member = SIP/202
member = SIP/203

extensions.conf

exten => _GEONUMBER,1,Answer
exten => _GEONUMBER,2,Queue(201)

the files included into var/lib/asterisk/moh/ are:
fpm-calm-river.wav fpm-sunshine.wav fpm-world-mix.wav

Someone can help me?
Bye.

Just another question, i use G729 codec, must i choose a wav file generic or a wav file coded for G729? Or the conversion is automatic?

Could you please help me

Trixbox 1.2
asterisk 1.2.18
When even PBX try to play music on hold it fails (silent) with following log.

“music class default requested but no musiconhold loaded”

Files
musiconhold_addition
[backup]
mode=files
directory=/var/lib/asterisk/mohmp3/backup/
[default]
mode=files
directory=/var/lib/asterisk/mohmp3/
[test]
mode=files
directory=/var/lib/asterisk/mohmp3/test/

Zapta.conf
musiconhold=default

I also record a file using asterisk voice recording and place it in /var/lib/asterisk/mohmp3/test/
but problem is still same.

Just wanted to say thank you to mjturner. Editing modules.conf and uncommenting res_musiconhold.so is exactly what I needed to get moh working!