Asterisk: Creating an Extension to Logout Agents from CallerID

I told a customer for the company I for that I would figure out how to logout agents by CID(Caller ID). So I figured, why not kill two birds with one stone. Today we will create a single Queue, Agent, and dial plan to accomplish this goal. I’m using Asterisk 1.4, Fedora 10 and a Polycom IP SIP phone for my demonstration purposes.

When I started this project four hours ago, I thought I would google my way to another successful blog post(and happy customer), but no…  logging out agents in Asterisk is very unintuitive.  The agentcallbacklogin utility has the exact same prompts for logging in as out.  AgentCallbackLogin (when initiated, from the dial plan)  asks for three things, agent, agent password, and call back number.  To eliminate all these prompts I’m using the ‘$CallerID(num)’ variable to automatically answer the agent and call back number.  So the user 8888 dials ‘1000’ and and AgentCallbackLogin assumes he is AGENT/8888 with a password of ‘8888’.

from /etc/asterisk/extensions.conf

exten => 1000,1,AgentcallbackLogin(${CALLERID(num)}||${CALLERID(num)}@savelono-queue-out)
exten => 1000,n,hangup

What I wanted to do, was to create a more intuitive way to log on/off an extension using the AgentCallbackLogin application.  So I use the $CallerID(num) variable to login AGENT/8888, but I can’t use the same syntax to log off an agent because logging off requires the agent to press the ‘#’ key when when prompted by AgentCallbackLogin for the dial back number.  If ${CALLERID(num)} already feeds the ‘dial back’ number then the user hears no prompt and cannot log out.  VoiP Wiki is full of misleading suggestions from prior versions of Asterisk.  Don’t waste your time.  I spent four ours researching this.  below is the configs I finally came up with.  I’m using extension 1000 to login agents based on CallerID to the savelono support queue.  Currently the way I have it, my agent and  password is identical to my Polycom SIP handset extension, ‘8888’.

from /etc/asterisk/extensions.conf

exten => 1000,1,AgentcallbackLogin(${CALLERID(num)}||${CALLERID(num)}@savelono-queue-out)
exten => 1000,n,hangup
;Logoff this way works but is not very intuitive because you
;have to hit the # key when prompted for a dial back extension
;it really doesn’t make sense to endusers
exten => 1002,1,AgentcallbackLogin(${CALLERID(num)}||)
exten => 1002,n,hangup

It took me hours or researching before I finally gave up.  For some reason, as awsome as Asterisk is, it is exceedingly difficult log a agent out of a queue with the AgentCallbackLogin application.  Logging into the Queue is pretty straight forward. However in the short term I’m going to log them off with the system command.  I need to come up with some syntax to check if an agent is logged on before logging them out.

from /etc/asterisk/extensions.conf

exten => 1001,1,System(/usr/sbin/asterisk -rx “agent logoff Agent/${CALLERID(NUM)}”)
exten => 1001,n,RemoveQueueMember(savelono-support|Agent/${CALLERID(NUM)})
exten => 1001,n,Playback(agent-loggedoff)
exten => 1001,n,Playback(auth-thankyou)
exten => 1001,n,Hangup

/etc/asterisk/ Configuration files:


No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment