Callback agent without chan agent transfer problem

AgentCallBackLogin is going to be deprecated, so I’ve decided to emulate chan agent using AQM and RQM funcions and Local channel.
I have quite annoying problem using Local channel to emulate agents. I hope someone has already tried to solve it and could help me.
I used example 2 from … nt+channel and example from queues-with-callback-members.txt from asterisk 1.4 doc directory. My dialplan is very similar to digiums example. I will not post the whole dialplan because it’s quite large.
Agent Local/${agent}@agentdial is added to the queue using AQM where ${agent} is agent number.
Context agentdial looks like this

[agentdial] ; Local/${agent}@agentdial are dynamic queue members, they are added to the queue exten => _XX.,1,Noop(Agent to dial is ${EXTEN}) exten => _XX.,n,Set(agent=${EXTEN}) exten => _XX.,n,Set(ExtToDial=${DB(AGENT/${agent}/onExten)}) exten => _XX.,n,Macro(callagent,${LDP${ExtToDial}},e${ExtToDial})

callagent is macro which dials phone where agent is. The shortened version of this macro is:

;Macro which dials agent. It has to be used by cmd Queue.
; All agent must login using context which uses this macro.
;ARG1 - What device to dial (device)
;MACRO_EXTEN is dialed agent

exten => s,1,Gotoif($[${GROUP_COUNT(${MACRO_EXTEN}@agents)} > 0]?busyhere,1)
exten => s,n,Set(OUTBOUND_GROUP=${MACRO_EXTEN}@agents)
exten => s,n,Monitor(wav|/var/calls/${UNIQUEID})
exten => s,n,Dial(${ARG1},${AGENT_TIMEOUT},${DIAL_OPTIONS})
exten => s,n,Busy[/code]

As you can see I would like to monitor all calls to the agents so that’s where the problem is. If we use Local channel without /n option then monitor immediately stops when agent picks up the phone. This is normal behaviour of Local channel as developers say.
As a result I add Local/${agent}@agentdial/n to the queue. When one of the agents answers the call we see in the CLI:

-- Executing Dial("Local/102@agentdial-cf4a,2", "SIP/102|100|tr") in new stack -- Called 102 -- Local/102@agentdial-cf4a,1 is ringing -- SIP/102-0912f7b8 is ringing -- SIP/102-0912f7b8 answered Local/102@agentdial-cf4a,2 -- Local/102@agentdial-cf4a,1 answered SIP/101-0912cb98

CLI> show channels Channel Location State Application(Data) SIP/102-0912f7b8 (None) Up Bridged Call(Local/102@agentdi Local/102@agentdial- s@macro-callagent:13 Up Dial(SIP/102|100|tr) Local/102@agentdial- s@agentdial:1 Up Bridged Call(SIP/101-0912cb98) SIP/101-0912cb98 s@macro-dialqueue:2 Up Queue(q1|t) 4 active channels 2 active calls

The problem appears when agent tries to transfer call using asterisk blind transfer (tested for SIP, ZAP) or ZAP transfer using flash button.

[code]- Playing ‘pbx-transfer’ (language ‘en’)

  • Executing Dial(“Local/102@agentdial-cf4a,2”, “SIP/103|100|tr”) in new stack[/code]

Agent transfered the call and is now free but Local/102@agentdial-cf4a is still busy!

CLI> show queue q1 q1 has 0 calls (max unlimited) in 'roundrobin' strategy (11s holdtime), W:0, C:0, A:0, SL:0.0% within 0s Members: Local/102@agentdial/n (In use) has taken no calls yet Local/103@agentdial/n (Unknown) has taken no calls yet No Callers

Result: app_queue won’t call that agent (Local/102@agentdial/n) until SIP/103 stops talking to the called person.
There is no such problem if we use Local/102@agentdial without /n but we can’t monitor that channel as I’ve mentioned above. Problem should be solved in different way.

I thought of using M option of Dial command. Then dialing an agent would look like this:

exten => s,n,Dial(${ARG1},${AGENT_TIMEOUT},${DIAL_OPTIONS}M(beginmonitor^${FILENAME}))
Macro beginmonitor executes Monitor command and starts call recording. That works but the pause between picking up the phone and bridging two channels is quite big.

Thanks for reading this and sorry for my mistakes in English.

I use * 1.2.13 and latest 1.2.x zapata.

Any suggestions? May be I didn’t supply enough info?


I have exact problem on my test setup. The only way I’ve been able to made it working is using Blind Transfer (*1). Attended or SIP transfer doesnt look to work.

Problem look to be on the GROUP_COUNT that isn’t decremented/cleared on the originated channel on call transfer.

I really need to find a solution :smile: Bad, I’m not a C guru…

The only solution I see here is to begin monitor the channel before it enters queue. Then everything is monitored even after if it’s tranfered by an agent.
I don’t understand why AgentCallbackLigin is deprecated instead of being fixed. Local channel doesn’t work the same as chan_agent even if we don’t want monitor calls. If we use “/n” we have problem that Local channel is in use even after thansfer, if we don’t then Local channel is always “not in use” and we have to use outbound_group and send busy signal so anyway, agent is always dialed by the Queue.