[Asterisk-Users] Faking it: queue_log and addQueueMember

lenz lenz-ml at oinko.net
Mon Oct 10 11:18:45 MST 2005


Hello list,
today I have been busy playing with addQueueMember, and it is well known  
that it does not log to the queue_log file.

The answer - bad as it may seem - is to add a fake queue_log data for each  
logon and logoff. This was covered previously by  
http://lists.digium.com/pipermail/asterisk-dev/2005-February/009615.html

Unfortunately this solution is not so simple, because:
1. when an agent logs off, they log how much time they have been on line
2. multiple logon/logoff lines are *bad* for log analysis

I have written a simple logon-logoff script that might help you in "faking  
it". Of course you should likely add authentication for a real-world  
usage. To do the adding, you dial 422XX, where XX is your local extension;  
the same goes to be removed from queue.

; addqueuemember - 422
exten => _422XX,1,Answer
exten => _422XX,2,AddQueueMember(my-queue,SIP/${EXTEN:3})
exten => _422XX,3,System( echo  
"${EPOCH}|${UNIQUEID}|NONE|SIP/${EXTEN:3}|AGENTLOGIN|-" >> /var/
log/asterisk/queue_log )
exten => _422XX,4,DBput(dynlogin/log_Agent-${EXTEN:3}=${EPOCH})
exten => _422XX,5,Hangup

; removequeuemember - 423
exten => _423XX,1,Answer
exten => _423XX,2,RemoveQueueMember(my-queue,SIP/${EXTEN:3})
exten => _423XX,3,DBget(ORGEPOCH=dynlogin/log_Agent-${EXTEN:3})
exten => _423XX,4,Set(RV=$[${EPOCH} - ${ORGEPOCH}])
exten => _423XX,5,GotoIf($["${RV}" = "0"]?8:6)
exten => _423XX,6,System( echo  
"${EPOCH}|${UNIQUEID}|NONE|SIP/${EXTEN:3}|AGENTLOGOFF|-|${RV}"
>> /var/log/asterisk/queue_log )
exten => _423XX,7,DBdel(dynlogin/log_Agent-${EXTEN:3})
exten => _423XX,8,Hangup

Hope this helps. With this setup, I verified that the queue_log can be  
analyzed by QueueMetrics and the dynamic agent shows up fine (albeit with  
the name of a terminal, like SIP/23, instead of the usual Agent/23 string,  
but you can modify it in QM itself).

This setup might even be used in a call center where agents are not  
actually used but queues connect straight to terminals to "fake" agent  
logon/logoff, in order to have such data available for reporting.

Any comment is welcome!
l.



-- 
Assum est, versa et manduca.



More information about the asterisk-users mailing list