Multiple Queues Agent Login Logout


i’ve configured 2 asterisk extensions which allow an agent to Login or Logout from all the Queues are available on the PBX.

It is very handy when your Box has lots of queues. (Of course the numbers can be changed to anything)

For Login a user dials 9998

exten => 9998,1,Answer
exten => 9998,2,Set(QEXT1=${CALLERID(number)})
exten => 9998,3,MYSQL(Connect connid localhost USER PASS asterisk)
exten => 9998,4,MYSQL(Query resultid ${connid} SELECT\ DISTINCT\ ‘id’\ FROM\ ‘queues’)
exten => 9998,5,MYSQL(Fetch foundRow ${resultid} id)
exten => 9998,6,GotoIf($["${foundRow}" = “1”]?7:9)
exten => 9998,7,AddQueueMember(${id}|Local/${QEXT1}@from-internal/n)
exten => 9998,8,Goto(5)
exten => 9998,9,MYSQL(Clear ${resultid})
exten => 9998,10,MYSQL(Disconnect ${connid})
exten => 9998,11,Playback(agent-loginok)
exten => 9998,12,Hangup

For Logout a user dials 9997

exten => 9997,1,Answer
exten => 9997,2,Set(QEXT1=${CALLERID(number)})
exten => 9997,3,MYSQL(Connect connid localhost USER PASS asterisk)
exten => 9997,4,MYSQL(Query resultid ${connid} SELECT\ DISTINCT\ ‘id’\ FROM\ ‘queues’)
exten => 9997,5,MYSQL(Fetch foundRow ${resultid} id)
exten => 9997,6,GotoIf($["${foundRow}" = “1”]?7:9)
exten => 9997,7,RemoveQueueMember(${id}|Local/${QEXT1}@from-internal/n)
exten => 9997,8,Goto(5)
exten => 9997,9,MYSQL(Clear ${resultid})
exten => 9997,10,MYSQL(Disconnect ${connid})
exten => 9997,11,Playback(agent-loggedoff)
exten => 9997,12,Hangup

If you have any questions you can contact me: e-mail:
[email protected]