text
stringlengths
0
152
219
same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(endpoint)})
same => n,RemoveQueueMember(support,${MemberChannel})
same => n,Verbose(1,${RQMSTATUS}) ; REMOVED, NOTINQUEUE, NOSUCHQUEUE
same => n,Playback(agent-loggedoff)
same => n,Hangup()
exten => *734,1,Verbose(2,Pause Queue Member)
same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(endpoint)})
same => n,PauseQueueMember(support,${MemberChannel})
same => n,Verbose(1,${PQMSTATUS}) ; PAUSED, NOTFOUND
same => n,Playback(dictate/paused)
same => n,Hangup()
exten => *735,1,Verbose(2,Unpause Queue Member)
same => n,Set(MemberChannel=${CHANNEL(channeltype)}/${CHANNEL(endpoint)})
same => n,UnpauseQueueMember(support,${MemberChannel})
same => n,Verbose(1,${UPQMSTATUS}) ; UNPAUSED, NOTFOUND
same => n,Playback(agent-loginok)
same => n,Hangup()
exten => *98,1,NoOp(Access voicemail retrieval.)
Automatically Logging Into and Out of Multiple Queues
It is quite common for an agent to be a member of more than one queue. Rather than
having a separate extension for logging into each queue (or demanding information
from the agents about which queues they want to log into), this code uses the Asterisk
database (astdb) to store queue membership information for each agent, and then
loops through each queue the agents are a member of, logging them into each one in
turn.
In order for this code to work, an entry similar to the following will need to be added
to the AstDB via the Asterisk CLI. For example, the following would store the mem‐
ber SOFTPHONE_A as being in both the support and sales queues:3
*CLI> database put queue_agent SOFTPHONE_A/available_queues support^sales
You will need to do this once for each agent, regardless of how many queues they are
members of.
If you then query the Asterisk database, you should get a result similar to the
following:
pbx*CLI> database show queue_agent
/queue_agent/SOFTPHONE_A/available_queues : support^sales
The following dialplan code is an example of how to allow this queue member to be
automatically added to both the support and sales queues. We’ve defined a
3 We’re going to use the ^ character as a delimiter. You could probably use another character instead, just so
long as it’s not one the Asterisk parser would see as a normal delimiter (and thus get confused by). So avoid
commas, semicolons, and so forth.
220
|
Chapter 12: Automatic Call Distribution Queues
subroutine that is used to set up three channel variables (MemberChannel, MemberChan
Type, AvailableQueues). These channel variables are then used by the login (*736),
logout (*737), pause (*738), and unpause (*739) extensions. Each of the extensions
uses the subSetupAvailableQueues subroutine to set these channel variables and to
verify that the AstDB contains a list of one or more queues for the device the queue
member is calling from.
Near the end of your extensions.conf file, where you’ve put your subroutines, add the
following:
[subSetupAvailableQueues]
; This subroutine is used by the various login/logout/pausing/unpausing routines
; in our multiple queue login example.
;
exten => start,1,Verbose(2,Checking for available queues)
; Get the current channel's peer name
same => n,Set(MemberChannel=${CHANNEL(endpoint)})
; Get the current channel's technology type
same => n,Set(MemberChanType=${CHANNEL(channeltype)})
; Get the list of queues available for this agent
same => n,Set(AvailableQueues=${DB(queue_agent/${MemberChannel}/available_queues)})
; if there are no queues assigned to this agent we'll handle it in the
; no_queues_available extension
same => n,GotoIf($[${ISNULL(${AvailableQueues})}]?no_queues_available,1)
same => n,Return()
exten => no_queues_available,1,Verbose(2,No queues available for agent ${MemberChannel})
; playback a message stating the channel has not yet been assigned
same => n,Playback(silence/1&channel&not-yet-assigned)
same => n,Hangup()
Next, in your [sets] context, add the following:
; Logging into multiple queues via the AstDB system
exten => *736,1,Verbose(2,Logging into multiple queues per the database values)
; get the available queues for this channel
same => n,GoSub(subSetupAvailableQueues,start,1())
same => n,Set(QueueCounter=1) ; setup a counter variable
; using CUT(), get the first listed queue returned from the AstDB