Introduction To Agent Login In AsteriskNOW
This blog explains how an agent can login to a queue directly through an extension in Agent Login In AsteriskNOW. In asterisk’s terms an agent is human and an extension is device. Here an agent will be able to login into the queue through an extension by dialing a queue login number and you do not need to make any configurations in agents.conf or queues.conf. For this setup to work properly, you need to have the correct dialplans in corresponding extension files.
Agent Login In AsteriskNOW Steps
In the case of asteriskNOW, extension_additional.conf contains dialplans to handle queue login.
[bash]
[ext-queues]
exten => 5000*,1,Macro(agent-add,5000,)
exten => 5000**,1,Macro(agent-del,5000,5000)
[/bash]
If [macro-agent-add] and [macro-agent-del] contexts are already present in extensions_additional.conf you need to put the dialplans for these contexts in /etc/asterisk/extensions_override_freepbx.conf otherwise you can add the dialplans in /etc/asterisk/extensions_custom.conf.
[bash]
[macro-agent-add]
include => macro-agent-add-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(CALLBACKNUM=${AMPUSER})
exten => s,n,AddQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(Agentlogin,Agent: ${CALLBACKNUM})
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loginok&with&extension)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Hangup
exten => s,n,MacroExit()
exten => s,n(invalid),Playback(pbx-invalid)
exten => s,n,Goto(a3)
; end of [macro-agent-add]
[macro-agent-del]
include => macro-agent-del-custom
exten => s,1,Wait(1)
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n,Set(CALLBACKNUM=${AMPUSER})
exten => s,n,ExecIf($[“${CALLBACKNUM}” = “”],Set,CALLBACKNUM=${CALLERID(number)})
exten => s,n,RemoveQueueMember(${ARG1},Local/${CALLBACKNUM}@from-internal/n)
exten => s,n,UserEvent(RefreshQueue)
exten => s,n,Wait(1)
exten => s,n,Playback(agent-loggedoff&with&extension)
exten => s,n,SayDigits(${CALLBACKNUM})
exten => s,n,Hangup
; end of [macro-agent-del]
[/bash]
In this dialplan 5000 is the queue number. You can use any queue number instead of it. To login to queue dial 5000* from your phone (either a softphone like xlite or a hard phone like Linksys) and you will hear a login confirmation and to logout from the queue you need to dial 5000** as per the dial plan. The advantage of this method is that an agent can do a login or logout by just dialing the corresponding number. Once logged in we can check current members in the queue using the command.
[bash]
From shell
#asterisk -rx “queue show 5000” (5000 is the queue number)
From asterisk CLI
> queue show 5000
[/bash]