Gilles
2011-Mar-03 14:13 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait until callee answers?
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(): ===========;call made through Dial(): Doesn't proceed after off-hook/hangup [internal] exten => 8888,1,Dial(Zap/1/${IPPI}) exten => 8888,n,NoOp(We never get there) exten => 8888,n,Hangup =========== ;call made through callfile: Doesn't wait for off-hook [callbacktest] exten => start,1,NoOp(DialStatus is ${DIALSTATUS}) exten => start,n,NoOp(${CHANNEL(state)}) exten => start,n,Playback(tt-monkeysintro) exten => start,n,Wait(2) exten => start,n,Hangup =========== ;tried this to force callfile to wait until off-hook [callbacktest] exten => start,1,Set(INDEX=0) ;Down, Rsrvd, OffHook, Dialing, Ring, Ringing, Up, Busy, Dialing ;Offhook, Pre-ring, Unknown ;Tried "Up", "OffHook", and "Rsrvd", to no avail exten => start,n,While($["${CHANNEL(state)}" != "Up" & ${INDEX} < 10]) exten => start,n,NoOp(Channel still ringing: ${CHANNEL(state)}) exten => start,n,Wait(1) exten => start,n,Set(INDEX=$[${INDEX} + 1]) exten => start,n,EndWhile() =========== 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.
Danny Nicholas
2011-Mar-03 14:42 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait until calleeanswers?
-----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.
Gilles
2011-Mar-07 14:14 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait until calleeanswers?
On Thu, 3 Mar 2011 08:42:36 -0600, "Danny Nicholas" <danny at debsinc.com> wrote:>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:I was going through the script this afternoon, and have a couple of questions: 1. Why use ">" instead of "=" to compare the extension with "SIP"? exten => s,n,Gotoif($["${EXTEN}" > "SIP"]?start) 2. According to www.voip-info.org/wiki/view/Asterisk+cmd+Wait, Wait only takes one parameter, while WaitExten() can take "m", which plays music on hold: Is the wiki out of date and you are using a more recent version of Asterisk than the 1.4 I have? exten => s,n,Wait(9,m) Thank you.
Danny Nicholas
2011-Mar-07 14:20 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait untilcalleeanswers?
-----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Gilles Sent: Monday, March 07, 2011 8:14 AM To: asterisk-users at lists.digium.com Subject: Re: [asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait untilcalleeanswers? On Thu, 3 Mar 2011 08:42:36 -0600, "Danny Nicholas" <danny at debsinc.com> wrote:>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:I was going through the script this afternoon, and have a couple of questions: 1. Why use ">" instead of "=" to compare the extension with "SIP"? exten => s,n,Gotoif($["${EXTEN}" > "SIP"]?start) 2. According to www.voip-info.org/wiki/view/Asterisk+cmd+Wait, Wait only takes one parameter, while WaitExten() can take "m", which plays music on hold: Is the wiki out of date and you are using a more recent version of Asterisk than the 1.4 I have? exten => s,n,Wait(9,m) Thank you. #1 is "Lazy notation" to say ${EXTEN} starts with SIP (as opposed to Local or DAHDI) #2 Might just be a typo on my part. I frequently switch usage between Wait() and WaitExten().
Gilles
2011-Mar-07 16:19 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait untilcalleeanswers?
On Mon, 7 Mar 2011 08:20:26 -0600, "Danny Nicholas" <danny at debsinc.com> wrote:>#1 is "Lazy notation" to say ${EXTEN} starts with SIP (as opposed to Local >or DAHDI) >#2 Might just be a typo on my part. I frequently switch usage between Wait() >and WaitExten().Thanks for the clarification.
Tilghman Lesher
2011-Mar-07 17:46 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to wait untilcalleeanswers?
On Monday 07 March 2011 08:20:26 Danny Nicholas wrote:> On Monday 07 March 2011 08:14:27 Gilles wrote: > > 1. Why use ">" instead of "=" to compare the extension with "SIP"? > > > > exten => s,n,Gotoif($["${EXTEN}" > "SIP"]?start) > > #1 is "Lazy notation" to say ${EXTEN} starts with SIP (as opposed to > Local or DAHDI)Then you probably want ${CHANNEL}, not ${EXTEN}. ${EXTEN} is always going to be "s", which is always greater than "SIP". -- Tilghman
Danny Nicholas
2011-Mar-07 17:59 UTC
[asterisk-users] [1.4] Forcing Asterisk/Zaptel to waituntilcalleeanswers?
-----Original Message----- From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Tilghman Lesher Sent: Monday, March 07, 2011 11:47 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] [1.4] Forcing Asterisk/Zaptel to waituntilcalleeanswers? On Monday 07 March 2011 08:20:26 Danny Nicholas wrote:> On Monday 07 March 2011 08:14:27 Gilles wrote: > > 1. Why use ">" instead of "=" to compare the extension with "SIP"? > > > > exten => s,n,Gotoif($["${EXTEN}" > "SIP"]?start) > > #1 is "Lazy notation" to say ${EXTEN} starts with SIP (as opposed to > Local or DAHDI)Then you probably want ${CHANNEL}, not ${EXTEN}. ${EXTEN} is always going to be "s", which is always greater than "SIP". -- Tilghman I said it was Lazy, and I did this back on 1.4.21 under Zaptel. The ${EXTEN} was sufficient for my purposes, though looking back I see it is not "syntactically" correct.