[asterisk-users] Requiring agent to confirm queue calls only when forwarded to external device

Phil Frost phil at macprofessionals.com
Fri Aug 17 12:26:37 CDT 2012


On 08/17/2012 10:09 AM, Phil Frost wrote:
> On 08/17/2012 02:28 AM, Olle E. Johansson wrote:
>> If a call is forwarded and hit the dialplan again, it's forwarded to 
>> the context set in the channel variable FORWARD_CONTEXT.
>>
>> So you could set this variable before you hit queue(), then do things 
>> differently in the context specified by this variable, since you know 
>> that the call is forwarded.
>
> This sounds like just what I need, but I can't get it to work. Looks 
> to me like FORWARD_CONTEXT is being ignored, and the forward target 
> number is being interpreted in the default context. Am I doing 
> something wrong?

After some headbanging, I found an alternate solution. I enter the queue 
like this:

same => n(to-queue),Set(__queue_call=yes)
same => n,Queue(${queuename},${app_options},,,300)

The double underscores make queue_call inherited by channels spawned 
later. Thus, I can add some logic to detect this, and behave 
differently. I renamed my previous context "handsets" to 
"handsets-no-confirmation-required", and added this:

[handsets]

exten => _[#*0-9]!,1,NoOp()
     ; for queue calls, require the called party to accept the call with 
a DTMF
     ; response before connecting. This avoids queue calls from being 
eaten by
     ; voicemail and other such automated systems.
     same => 
n,GotoIf($["${queue_call}"="yes"]?handsets-confirmation-required,${EXTEN},1)
     same => n,Goto(handsets-confirmation-not-required,${EXTEN},1)

[handsets-confirmation-required]

exten => _[#*0-9]!,1,Verbose(3,Calling ${EXTEN} with confirmation required)
     same => 
n,Dial(Local/${EXTEN}@handsets-confirmation-not-required,,U(confirm-call))
     same => n,Hangup(NO_ANSWER)

[confirm-call]

exten => s,1,Verbose(3,confirming call)
     same => n,Background(followme/no-recording)
     same => n,Background(followme/options)
     same => n,WaitExten(10)
     same => n,Goto(2,1)

exten => 1,1,Verbose(3,call confirmed)
     same => n,Return()

exten => 2,1,Verbose(3,call rejected)
     same => n,Set(GOSUB_RESULT=CONTINUE)
     same => n,Return()

exten => _[it],1,Goto(s,1)

Works great.




More information about the asterisk-users mailing list