Add queue members dynamically

Hi,

We are currently running version 5.6 distro with a custom function for joining queues:

exten => 7000,1,AddQueueMember(700,SIP/${CALLERID(num)})
exten => 7000,2,Playback(agent-loginok)
exten => 7000,3,Hangup
exten => 7001,1,RemoveQueueMember(700,SIP/${CALLERID(num)})
exten => 7001,2,Playback(agent-loggedoff)
exten => 7001,3,Hangup

Currently when a member joins the queue they are listed as SIP/extnum, however I would like to see the agent name instead (or as well as)

What would I need to add to the queue line to get this info working?

Drac

You can not add members like that. You are missing all the hints and other items. Go look at how FreePBX adds members with the login feature code.

Tony, the above method does work in as much as it logs users into the queue. It’s just that the feedback from the system won’t give me usernames, only extensions.

I did find this:

[macro-agent-add]
include => macro-agent-add-custom
exten => s,1,Wait(1)
exten => s,n,Set(QUEUENO=${ARG1})
exten => s,n,Macro(user-callerid,SKIPTTL)
exten => s,n(a3),Read(CALLBACKNUM,agent-login,)
exten => s,n,GotoIf($[${LEN(${CALLBACKNUM})}=0]?a5:a7)
exten => s,n(a5),Set(CALLBACKNUM=${IF($[${LEN(${AMPUSER})}=0]?${CALLERID(number)}:${AMPUSER})})
exten => s,n,Set(THISDEVICE=${DB(DEVICE/${REALCALLERIDNUM}/dial)})
exten => s,n,GotoIf($["${CALLBACKNUM}" = “”]?a3)
exten => s,n(a7),GotoIf($["${CALLBACKNUM}" = “${QUEUENO}”]?invalid)
exten => s,n,GotoIf($["${ARG3}" = “EXTEN” & ${DB_EXISTS(AMPUSER/${CALLBACKNUM}/cidname)} = 0]?invalid)
exten => s,n,GotoIf($["${DB(QPENALTY/${QUEUENO}/dynmemberonly)}" = “yes” & ${DB_EXISTS(QPENALTY/${QUEUENO}/agents/${CALLBACKNUM})} != 1]?invalid)
exten => s,n,ExecIf($["${QREGEX}" != “”]?GotoIf($["${REGEX("${QREGEX}" ${CALLBACKNUM})}" = “0”]?invalid))
exten => s,n,ExecIf($["${ARG2}" != “”]?Authenticate(${ARG2}))
exten => s,n,ExecIf($[${DB_EXISTS(AMPUSER/${CALLBACKNUM}/cidname)} = 1 & “${DB(AMPUSER/${CALLBACKNUM}/queues/qnostate)}” != “ignorestate”]?AddQueueMember(${QUEUENO},Local/${CALLBACKNUM}@from-queue/n,${DB(QPENALTY/${QUEUENO}/agents/${CALLBACKNUM})},${DB(AMPUSER/${CALLBACKNUM}/cidname)},hint:${CALLBACKNUM}@ext-local))
exten => s,n,ExecIf($[${DB_EXISTS(AMPUSER/${CALLBACKNUM}/cidname)} = 1 & “${DB(AMPUSER/${CALLBACKNUM}/queues/qnostate)}” = “ignorestate”]?AddQueueMember(${QUEUENO},Local/${CALLBACKNUM}@from-queue/n,${DB(QPENALTY/${QUEUENO}/agents/${CALLBACKNUM})},${DB(AMPUSER/${CALLBACKNUM}/cidname)}))
exten => s,n,ExecIf($[${DB_EXISTS(AMPUSER/${CALLBACKNUM}/cidname)} = 0]?AddQueueMember(${QUEUENO},Local/${CALLBACKNUM}@from-queue/n,${DB(QPENALTY/${QUEUENO}/agents/${CALLBACKNUM})}))
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] ==–;

in extensions_additional.conf. So in theory I should be able to copy the code into my custom feature and it should login the agent using 7000…

I will give it a go and get back…

Thanks for the advice :slight_smile:

Drac

Ok, by setting the QUEUENO variable to 700 this worked in joining a member to a queue and gave me the Username rather than the SIP/exten. However, the user has to enter their exten number for this to work (which in the past have proven too much for our users). So I need the code to read the number calling 7000 and add them to the queue. As you may well guess, my knowledge on this matter is limited so a little help goes a long way.

Regards
Drac

We have a feature code just for this. *45 logs the agent into every queue they are listed as a dynamic member of in the Queue module.

We did use the *45 option in the past, but I hadn’t realised that just dialling 45 would log you in to any queue you are a dynamic member of, so we had been using 45500#, and we also tried with 500 which would prompt the user to enter their ext number, which in turn was too difficult for some users.

I did get my method to work in the end…So I have learnt something new, which is always a bonus, even if I didn;t need to learn it:

; Join queue 700 and allow Username to be passed rather than SIP/extn
exten => 7000,1,Wait(1)
exten => 7000,n,Macro(user-callerid,SKIPTTL)
exten => 7000,n,Set(CALLBACKNUM=${AMPUSER})
exten => 7000,n,AddQueueMember(700,Local/${CALLBACKNUM}@from-queue/n,${DB(AMPUSER/${CALLBACKNUM}/cidname)})
exten => 7000,n,UserEvent(AgentLogin,Agent:${CALLBACKNUM})
exten => 7000,n,Wait(1)
exten => 7000,n,Playback(agent-loginok&with&extension)
exten => 7000,n,SayDigits(${CALLBACKNUM})
exten => 7000,n,Wait(2)
exten => 7000,n,Hangup
exten => 7000,n,MacroExit()

So wasn’t a complete waste of time.

Thanks again for your help, it pointed me to where I needed to be

Drac