I am using call files to make outbound calls and play sound files to users.
However, asterisk doesn’t wait till the user picks up the call. Often times, this leads to the sound file playing prematurely. How do I make sure the user has picked up the call before I play a sound file.
Here’s my call file:
Channel: DAHDI/G0/1234567123
MaxRetries: 2
RetryTime: 60
WaitTime: 30
Context: test-background2
Extension: s
Set: FileName=test_dialplan_background1
Archive: yes
Here’s my context in extensions.conf:
[test-background2]
exten => s,1,Answer()
exten => s,2,Wait(15)
exten => s,3,Set(filename=${CUT(FileName,1)}.response)
exten => s,4,Set(newcount=0)
exten => s,5,Gotoif($[ $[ ${newcount} > 1] ]?test-background2,10,2:response)
exten => s,6(response),Background(caller_response)
exten => s,7,Set(newcount=$[${newcount} + 1])
exten => s,8,WaitExten(4)
exten => 3,1,Playback(appt_confirm)
exten => 3,2,System(/bin/echo “Key pressed is 3” >> /var/spool/asterisk/outgoing_done/${filename})
exten => 3,3,Hangup()
exten => 7,1,Playback(appt_cancel)
exten => 7,2,System(/bin/echo “Key pressed is 7” >> /var/spool/asterisk/outgoing_done/${filename})
exten => 7,3,Hangup()
exten => 9,1,System(/bin/echo “Key pressed is 9” >> /var/spool/asterisk/outgoing_done/${filename})
exten => 9,2,GoTo(test-background2,s,6)
exten => i,1,GoTo(test-background2,s,6)
exten => t,1,GoTo(test-background2,s,5)
exten => 10,1,Playback(caller_message)
exten => 10,2,Hangup()
Please help.