Music On Hold doesn't work form the Dial() Application

Hi everybody!

I’m trying to enable music on hold feature and using the following extension:

exten => _[1-2],1,NoOp()
same => n,Dial(SIP/${EXTEN},30,m)
same => n,Playback(vm-nobodyavail)
same => n,Hangup()

But the music doesn’t play! At the same time when I use the MusicOnHold() Application it works:

exten => 3,1,NoOp()
same => n,Answer()
same => n,MusicOnHold()
same => n,Hangup()

MusicOnHold.conf content is:

[default]

mode=files
directory=/var/lib/asterisk/moh/1

Here’s the log (when calling from ext. 1 to ext. 2):

== Using SIP RTP CoS mark 5
– Executing [1@LocalContext:1] NoOp(“SIP/2-0000001e”, “”) in new stack
– Executing [1@LocalContext:2] Dial(“SIP/2-0000001e”, “SIP/1,30,m”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/1
– Started music on hold, class ‘default’, on channel ‘SIP/2-0000001e’
– SIP/1-0000001f is ringing
– Nobody picked up in 30000 ms
– Stopped music on hold on SIP/2-0000001e
– Executing [1@LocalContext:3] Playback(“SIP/2-0000001e”, “vm-nobodyavail”) in new stack
> 0x7f9190010bd0 – Probation passed - setting RTP source address to 172.25.115.109:8000
– <SIP/2-0000001e> Playing ‘vm-nobodyavail.alaw’ (language ‘ru_RU’)
> 0x7f9190010bd0 – Probation passed - setting RTP source address to 172.25.115.109:8000
– Executing [1@LocalContext:4] Hangup(“SIP/2-0000001e”, “”) in new stack
== Spawn extension (LocalContext, 1, 4) exited non-zero on ‘SIP/2-0000001e’
– Executing [h@LocalContext:1] Hangup(“SIP/2-0000001e”, “”) in new stack
== Spawn extension (LocalContext, h, 1) exited non-zero on ‘SIP/2-0000001e’

So it looks like music on hold work but in fact I can hear only regular dial tones

Could someone help me with this problem?

Early media tends to need an explicit call of Progress to work. This assumes the calling line supports early media at all.

In my environment this problem appears on Asterisk 13.1-cert2 and 13.3.2. When I make Asterisk 11.6-cert11 with the same set of modules and use the same configurations files MOH works just great

On all these releases modules.conf contains this:

[modules]

load => app_dial.so
load => app_playback.so
load => bridge_simple.so
load => chan_local.so
load => chan_sip.so
load => codec_a_mu.so
load => codec_alaw.so
load => codec_g722.so
load => codec_g726.so
load => codec_ulaw.so
load => format_wav.so
load => format_wav_gsm.so
load => pbx_config.so
load => res_crypto.so
load => res_http_websocket.so
load => res_musiconhold.so
load => res_rtp_asterisk.so

If you don’t have autoload turned on, then you’ll have to manually load res_musiconhold.so

Cheers

Yes, I know it. That’s why I’ve got “load => res_musiconhold.so” string in my modules.conf file (as I sad in the previous post). I also tried to make Asterisk 13.1-cert2 with the default set of modules (which includes res_musiconhold.so) and autoload them. The result was the same - music on hold didn’t play