Andrey Solovjov
2006-Nov-21 05:14 UTC
[asterisk-users] Callback agents without chan_agent issues (queue recording)
AgentCallBackLogin is going to be deprecated, so I've decided to emulate chan agent using AQM and RQM funcions and Local channel. I use asterisk 1.2.13 and latest 1.2.x. zapata. I used example 2 from http://www.voip-info.org/wiki/view/Agents+without+agent+channel and example from queues-with-callback-members.txt from asterisk 1.4 doc directory. My dialplan is very similar to Digium's 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}) LDP${ExtToDial} is global variable where Tech/peer is stored (for example SIP/102) callagent is macro which dials phone where agent is. The shortened version of this macro is: [macro-callagent] ;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 As you can see I would like to monitor all calls to the agents. 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 a result I add Local/${agent}@agentdial/n to the queue. After that I can record calls. The problem appears when agent tries to transfer call using asterisk blind transfer (tested for SIP, ZAP) or ZAP transfer using flash button. - Playing 'pbx-transfer' (language 'en') - Executing Dial("Local/102@agentdial-cf4a,2", "SIP/103|100|tr") in new stack Agent transfered the call and is now doing nothing 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 calling person stop talking to SIP/103. 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 large. Thanks for reading this and sorry for my mistakes in English. Andrey Solovjov