Play a file to callee and hangup with dial application

Hi everyone
I need to call to a number, play a sound file and hangup.
Example, call to extension number 500, play sound-file.gsm and automatically hang up after 5 seconds of answered channel.
My current setup is:

exten => 500,1,answer()
exten => 500,n,dial(sip/500,30,A(custom/sound-file)L(5000))
exten => 500,n,hangup()

But no success. Option A and option L work individual. But using A and L at the same time does not work.
Any idea is appreciated. Thanks

How about making sure the sound file you play is 5 seconds long?


question who is calling ?
are you using originate or is it an user that call 500
can you please descripe your use case, what how is calling and who is 500
if you are using originate, call 500 and then use Playback


Hi Mark
No i do not use originate, some users call 500 using their ip phones. I want to make two seprate call when some body call 500.
First to 500 that is set on an ip phone.
Second on a sip speaker that is auto answer (for example 501).
I want when the channel is answered a sound plays from the speaker to notify that user

Hi antony.
the sound file is 4 second, after sound finish. the channel stay open and nothing happened.

This works perfectly for me (it plays welcome, for extension 500, and hangs up after 5 seconds).

exten => 500,1,Answer()
exten => 500,n,Dial(PJSIP/500,30,A(welcome)L(5000))
exten => 500,n,Hangup()

But you don’t mention the Asterisk version and which module (but seeing the sip it’s probably chan_sip which isn’t supported anymore).

With Asterisk 20 and PJSIP it works correctly.

Do you have this in your logs?

Setting call duration limit to 5.000 seconds.

User A dial 500
Asterisk call SIP/500 how long should it be ringing and what should happen if SIP/500 answer
if SIP/500 do not answer you want it to call SIP/501 and play a messages first “Customer Call”
and then what should happen

User A dial 500
Asterisk create an Originate to SIP/501 that play a message “Customer Call on 500” and hangup
and at the same time Asterisk call SIP/500

exten => 500,1,Originate(SIP/501,app,playback,custom/sound-file)
same => n,Dial(SIP/500)
same => n,Hangup()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.