Wait for answer

i wants to publish a certain playback using a click2call PHP script,
so the scenario will be:
-user click on the click2call button
-asterisk will initiate a call to extension No. 69
-the extension 69 will play a certain sound file
-the user will receive a call on his mobile to listen to the sound file

so i added the following lines to “extensions_custom.conf”

exten => 69,1,Answer() exten => 69,n,Set(i=1) exten => 69,n,While($[${i} < 3]) exten => 69,n,Playback(/ccc/test) exten => 69,n,Wait(3) exten => 69,n,Set(i=$[${i} + 1]) exten => 69,n,EndWhile exten => 69,n,Hangup()

but the problem in this scenario that the sound file “test” starts playing before the mobile answers the call, also the loop is continues working if the mobile accepted the call and hang the line before finishing the process

any idea?

I assume you are using Originate.

There is no point in invoking Answer() as the outgoing side is the channel running in the PABX, and the PABX doesn’t start running until that is answered.

You have said nothing about the outgoing channel, but my guess is that it is an FXO dahdi channel with no answer supervision.

The easiest solution is to get answer supervision enabled on the line and properly configured in dahdi. Otherwise you are going to have to use things like wait for silence and time delays. Alternatively use a SIP based PSTN provider, who should be using a primary rate interface, with proper answer supervision.