# Agent-login-queue

**URL:** <https://community.asterisk.org/t/agent-login-queue/65815>\
**Category:** Asterisk Support\
**Created:** [February 28, 2016, 2:00am UTC](https://community.asterisk.org/t/agent-login-queue/65815 "2016-02-28T02:00:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hans04](https://avatars.discourse-cdn.com/v4/letter/h/f17d59/32.png) [@hans04](https://community.asterisk.org/u/hans04)\
**Post date:** [February 28, 2016, 2:00am UTC](https://community.asterisk.org/t/agent-login-queue/65815/1 "2016-02-28T02:00:30Z")

</div>

can someone tell me how i can avoid the agent login on one and more extensions phone and setup the BLF status of the phone in my dialplan …

Here is my code …

[agents]  
exten =\> \_09X,1,Dial(SIP/${EXTEN},90,t)  
same =\> n,Hangup

[operator064-agents]  
include =\> queues  
include =\> agents  
include =\> agent-functions  
include =\> localtel  
exten =\> \*1,1,Set(QUEUEDST=064)  
same =\> n,Goto(login,1)  
exten =\> \*2,1,Set(QUEUEDST=064)  
same =\> n,Goto(logout,1)  
exten =\> \*3,1,Goto(pause,1)  
exten =\> \*4,1,Goto(unpause,1)

[queues]  
exten =\> 066,1,Answer  
same =\> n,Set(QUEUE\_PRIO=5)  
same =\> n,Queue(064,t,34)  
same =\> n,Playback(/usr/share/asterisk/callcenter/track01)  
same =\> n,WaitExten(4)  
same =\> n,Set(QUEUE\_PRIO=10)  
same =\> n,Queue(064,t)  
same =\> n,Hangup

[agent-functions]  
exten =\> login,1,Answer()  
same =\> n,Set(COUNTER=0)  
same =\> n,Set(AGENT\_SOUND=agent-user)  
same =\> n(agent),Set(COUNTER=$[${COUNTER}+1])  
same =\> n,Read(AID,${AGENT\_SOUND});  
same =\> n,GotoIf($["${AGENT(${AID}:password)}"!=""]?auth)  
same =\> n,ExecIf($[${COUNTER}\<3],Set,AGENT\_SOUND=agent-incorrect)  
same =\> n,ExecIf($[${COUNTER}\<3],Goto,agent)  
same =\> n,Playback(beeperr)  
same =\> n,Hangup  
same =\> n(auth),Authenticate(${AGENT(${AID}:password)})  
same =\> n,Set(i=1)  
same =\> n,While($[${i}\<=${FIELDQTY(QUEUEDST,)}])  
same =\> n,Set(ARRAY(CURRENT\_QUEUE,CURRENT\_PENALTY)=${CUT(CUT(QUEUEDST,${i}),1)})  
same =\> n,AddQueueMember(${CURRENT\_QUEUE},Local/${CALLERID(num)}@${AGENT\_CONTEXT}/n,${CURRENT\_PENALTY},${AGENT(${AID}:name)})  
same =\> n,Set(i=$[${i}+1])  
same =\> n,EndWhile  
same =\> n,ExecIf($["${AQMSTATUS}"=“NOSUCHQUEUE”]?Playback(sorry&an-error-has-occured))  
same =\> n,ExecIf($["${AQMSTATUS}"!=“NOSUCHQUEUE”]?Playback(agent-loginok))  
same =\> n,Hangup  
exten =\> logout,1,Answer()  
same =\> n,Set(i=1)  
same =\> n,While($[${i}\<=${FIELDQTY(QUEUEDST,)}])  
same =\> n,Set(CURRENT\_QUEUE=${CUT(QUEUEDST,${i})})  
same =\> n,RemoveQueueMember(${CURRENT\_QUEUE},Local/${CALLERID(num)}@${AGENT\_CONTEXT}/n)  
same =\> n,Set(i=$[${i}+1])  
same =\> n,EndWhile  
same =\> n,Playback(agent-loggedoff)  
same =\> n,Hangup  
exten =\> pause,1,Answer()  
same =\> n,PauseQueueMember(,Local/${CALLERID(num)}@${AGENT\_CONTEXT}/n)  
same =\> n,NoOp(${PQMSTATUS})  
same =\> n,PlayTones(!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440)  
same =\> n,Wait(1.5)  
same =\> n,Playback(extension)  
same =\> n,Playback(dictate/paused)  
same =\> n,Wait(1.0)  
same =\> n,Hangup  
exten =\> unpause,1,Answer()  
same =\> n,UnPauseQueueMember(,Local/${CALLERID(num)}@${AGENT\_CONTEXT}/n)  
same =\> n,NoOp(${UPQMSTATUS})  
same =\> n,PlayTones(!350+440/100,!0/100,!350+440/100,!0/100,!350+440/100,!0/100,350+440)  
same =\> n,Wait(1.0)  
same =\> n,Playback(dictate/pause)  
same =\> n,Playback(cancelled)  
same =\> n,Wait(1.0)  
same =\> n,Hangup

---

<div class="post-metadata">

**Author:** ![david551](https://avatars.discourse-cdn.com/v4/letter/d/3bc359/32.png) [@david551](https://community.asterisk.org/u/david551)\
**Post date:** [February 28, 2016, 9:28am UTC](https://community.asterisk.org/t/agent-login-queue/65815/2 "2016-02-28T09:28:04Z")

</div>

There isn’t actually an agent login here, but to avoid a phone being sent to the IVR with the add and remove as a queue member options, change the context in the device technology configuration file (sip.conf, I guess) that defines the device so that it references another context.

Use the agents context if you want the phone to be able to call only numbers beginning with 09, and the queues context if you only want the phone to be able to call onto a queue. Define a new context if you want to do anything else.
