[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait until calleeanswers?

Danny Nicholas danny at debsinc.com
Thu Mar 3 08:42:36 CST 2011


-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gilles
Sent: Thursday, March 03, 2011 8:14 AM
To: asterisk-users at lists.digium.com
Subject: [asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait until
calleeanswers?

Hello

	I need to write a script that will dial a list of customers and play
a message.

I couldn't find a way to tell Asterisk/Zaptel to wait until the callee
has actually picked up the phone before proceeding with Playback():

<snip>

If there are people who use an FXO to make outgoing calls to perform
this type of task, how do you get Asterisk/Zaptel to wait until the
remote phone is off-hook?

Thank you.

Having traversed this "rabbit-hole" the answer is that it depends on your
carrier.  If they offer "call-supervision", asterisk can wait for pickup on
the other side.  The resolution I came up with for my offering:

; this context is used by AMI to play a message
[delivery]
exten => s,1,Answer
exten => s,n,Gotoif($["${EXTEN}" > "SIP"]?start)
exten => s,n,Wait(9,m)
exten => s,n,Set(IVRTRY=0)
exten => s,n(start),NoOp(Background(welcome))
exten => s,n,Background(important)
exten => s,n,WaitExten(5,m)
exten => s,n,Set(IVRTRY=$[${IVRTRY} +1])
exten => s,n,Verbose(Try ${IVRTRY})
exten => s,n,Gotoif($["${IVRTRY}" < "4"]?delivery|s|start)
exten => s,n,Goto(end-call|s|1)
exten => 1,1,ForkCDR(v,s(fullcmd=${Data}))
exten => 1,n,Background(${Data})
exten => 1,n,Background(repeatmsg)
exten => 1,n,WaitExten(3,m)
exten => 1,n,Goto(end-call|s|1)
exten => 2,1,Background(calllater)
exten => 2,n,ForkCDR(v,s(reject=${Data}))
exten => 2,n,Goto(end-call|s|1)
exten => 3,1,Goto(delivery|1|1)
exten => *,1,Goto(delivery|s|1)
exten => i,1,Goto(delivery|s|1)
exten => t,1,Goto(delivery|s|1)

If the call goes out over a SIP connection, we start immediately, otherwise
we play music for 9 seconds to give the line a chance to connect and pickup.
Then we play "important" and have the user press 1 to hear the message or 2
to get a call later.




More information about the asterisk-users mailing list