[asterisk-bugs] [JIRA] (ASTERISK-24267) Queue variables associated with setinterfacevar, setqueueentryvar, setqueuevar are not passed to local channel

Kevin Harwell (JIRA) noreply at issues.asterisk.org
Wed Dec 24 15:19:34 CST 2014


    [ https://issues.asterisk.org/jira/browse/ASTERISK-24267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=224225#comment-224225 ] 

Kevin Harwell commented on ASTERISK-24267:
------------------------------------------

This issue is not a bug and is working as expected in Asterisk 12+ and even in 11 (although in 11 it is undefined).

I'll try to explain what is happening. In this instance, when a customer originates the call it creates two local channels: ";1" and ";2". The ";2" channels goes into the queue and once the queue locates an agent, and that agent answers, then local channel ";2" and the agent channel are bridged and all queue channel variables are propagated to both (";2" and agent channel). However, neither of these channels is what is available when dialing the customer (in this case in the "dial-to-customer" context at "s" extension). Instead the available channel is local channel ";1" which does not have the queue channel variables on it.

This is the normal and expected behavior in Asterisk 12+ (with/without local channel optimization) as well as in Asterisk 11 (without local channel optimization). Things get a little more complicated when local channel optimization is enabled in Asterisk 11. The behavior should in most cases be the same. However if a "wait" is introduced that gives time for the local channels to be optimized out and the agent channel to be "masqueraded" in. This results in the agent channel (with all the queue channel variables) effectively running dialplan.

Since this is a source of undefined behavior in Asterisk 11 and simply won't occur at all in Asterisk 12+ I'd recommend moving to a new workaround that would give access to the needed channel variables and works with all version of Asterisk.

Possible workaround:

For a given queue it is possible to specify a macro that will run when the agent answers and before execution of the "dial-to-customer" context/extension. This macro has access through the agent channel to the queue variables in question. Using dialplan it is then possible to locate the local channel ";1" and set shared variables on it. These shared variables can then be accessed later in the "dial-to-customer" context/extension.  Example dialplan:
{noformat}
[macro-sales]
exten => s,1,Noop(sales queue macro)
      ; get a list of all local channels
      same => n,Set(local_channels=${CHANNELS(Local/s at callmenow.*\;1)})
      ; find the one that has a shared "uid" and that matches "MMCALLMENOWID"
      same => n,While($["${SET(chan=${POP(local_channels, )})}" != ""])
      same => n,GotoIf($[${SHARED(uid,${chan})}=${MMCALLMENOWID}]?match)
      same => n,EndWhile
      same => n,Hangup()
      ; match was found
      same => n(match),Noop()
      ; write shared variable(s) to the matching local channel
      same => n,Set(SHARED(membername,${chan})=${MEMBERNAME})
  
[callmenow]
exten => s,1,NoOp(callmenow: Queue without answer)
      same =>n,Queue(sales,Rtc,,,,,sales)
  
[dial-to-customer]
exten => s,1,Noop(dial-to-customer channel=${CHANNEL(name)})
      ; retrieve the shared variable
      same => n,Noop(SHARED: ${SHARED(membername)})
{noformat}

In order for this to be able to match the locally originated channel to the answering agent channel two extra variables need to be specified on origination.  Below is an example using the same ami originate on the issue, but with an extra variable added (also note that MMCALLMENOWID is set to be inherited):
{noformat}
Action: Originate
Channel: Local/s at callmenow
Context: dial-to-customer
Exten: s
Priority: 1
Async: true
Variable: __MMCALLMENOWID=107
Variable: SHARED(uid)=107
Timeout: 999999
Callerid: Call Me Now <778>
{noformat}

> Queue variables associated with setinterfacevar, setqueueentryvar, setqueuevar are not passed to local channel
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: ASTERISK-24267
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24267
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Applications/app_queue, Channels/chan_local
>    Affects Versions: SVN, 12.5.0
>         Environment: Ubuntu 12.04 64 bit
> Asterisk 12.5 compiled from source
>            Reporter: Mitch Claborn
>            Assignee: Kevin Harwell
>         Attachments: v11.log, v12.log
>
>
> Various queue related variables are not being passed to the local channel when invoked from an AMI action.  This worked fine in 11.1.  I've tried the local channel with and without the /n flag.
> None of the following variables are present:
> QUEUESRVLEVELPERF
> QUEUESRVLEVEL
> QUEUEABANDONED
> QUEUECOMPLETED
> QUEUETALKTIME
> QUEUEHOLDTIME
> QUEUECALLS
> QUEUESTRATEGY
> QUEUEMAX
> QUEUENAME
> QEORIGINALPOS
> QEHOLDTIME
> MEMBERREALTIME
> MEMBERDYNAMIC
> MEMBERPENALTY
> MEMBERLASTCALL
> MEMBERCALLS
> MEMBERNAME
> MEMBERINTERFACE
> queue definition:
> {noformat}
> [StandardQueue](!) 
> musicclass=default 
> strategy=leastrecent 
> joinempty=no 
> leavewhenempty=yes 
> ringinuse=no 
> announce-frequency = 30
> min-announce-frequency = 15
> announce-holdtime = yes|no|once
> announce-position = limit
> announce-position-limit = 5
> announce-round-seconds = 10
> setinterfacevar = yes 
> setqueueentryvar = yes 
> setqueuevar = yes 
> wrapuptime=2 
> timeout = 16 
> autopause=yes  
> ;autopausedelay=30 
> autopausebusy=yes 
> autopauseunavail=yes
> reportholdtime=no 
> [sales](StandardQueue)
> {noformat}
> dial plan:
> {noformat}
> [callmenow]
> exten => s,1,NoOp(callmenow: Queue without answer)
>   same =>n,Queue(sales,Rtc)
>   
> [dial-to-customer]
> exten => s,1,NoOp(dial-to-customer channel=${CHANNEL(name)})
> 	same =>n,DumpChan()
> {noformat}
> AMI action
> {noformat}
> Action: Originate
> Channel: Local/s at callmenow/n
> Context: dial-to-customer
> Exten: s
> Priority: 1
> Async: true
> Variable: MMCALLMENOWID=107
> Timeout: 999999 
> Callerid: Call Me Now <778>
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list