Asterisk call queues
Queues consist of
- Incoming calls being placed in the queue
- Members that answer the queue (extensions or users that login as agents)
- A strategy for how to handle the queue and divide calls between members
- Music played while waiting in the queue
- Announcements for members and callers
Queues are defined in queues.conf or in dynamic realtime. The latter allow storing queue configuration in a database so that changes are immediately available for new callers without the need for an explicit reload.
- Agents are the people (or person) that answer call(s) that have been placed into a specific Queue. An agent logs in indicating that s/he is now ready to take calls. Asterisk transfers an inbound call to a queue, which is then in turn transfered to an available agent.
- Members are those channels that are active answering the Queue. It can be agents or normal channels, like "sip/snom23"
New in Asterisk v1.2
A queue is now considered empty not only if there are no members but also if none of the members are available (e.g. agents not logged on). To restore the original behavior, use "leavewhenempty=strict" or "joinwhenempty=strict" instead of "=yes" for those options.It is now possible to use multi-digit extensions in the exit context for a queue (although you should not have overlapping extensions, as there is no digit timeout). This means that the EXITWITHKEY event in queue_log can now contain a key field with more than a single character in it.
Members
Members can be direct channels, i.e. phones connected to Asterisk. You can also define members as individuals that login from any connection to receive calls.Agents are defined in agents.conf. Agents login from other phones on special extensions that use the agentlogin application.
Strategies
Calls are distributed among the members handling a queue with one of several strategies, defined in queues.conf- ringall: ring all available channels until one answers (default)
- roundrobin: take turns ringing each available interface (depreciated in 1.4, use rrmemory)
- leastrecent: ring interface which was least recently called by this queue
- fewestcalls: ring the one with fewest completed calls from this queue
- random: ring random interface
- rrmemory: round robin with memory, remember where we left off last ring pass
Menu for the user
You can define a menu for the user, while waiting. For this menu, you can only use one-digit extensions. Define the context for the menu in the configuration for the queue to enable this option.Penalties
Queue members can be defined as having a penalty - e.g.member => SIP/200,1
member => SIP/201,2
member => SIP/202,3
member => SIP/203,2
If the strategy is defined as 'ringall', then only those available members with the lowest priorities will ring. In the example above, if 200 is not busy, then only 200 will ring. If 200 is busy, then only 201 and 203 will ring. If 200, 201 and 203 are busy, then 202 will ring.
Note: If extension 200 does not pick up it will not automatically go to extension 201. It will keep ringing 200 until they pick up. It will only go to the next extension if the current extension is either busy or unavailable.
Cascading Queues
You can set up a series of queues that cascade to each other. You can get a similar effect by using the penalty feature but this can be a better way to do things for some situations (e.g. if you want to overflow calls to your receptionist into your office for when your receptionist is busy).The first thing you must do is have a timeout on our queue. This is done as a parameter of the Queue command used in extensions.conf (example: Queue(dave|t|||45)).
You can then set up a number of queues and simply have your dialplan call each queue in succession.
example:
exten => 1589,1,Answer
exten => 1589,2,Ringing
exten => 1589,3,Wait(2)
exten => 1589,4,Queue(testq|t|||45)
exten => 1589,5,Queue(testq2|t|||45)
exten => 1589,6,Hangup
New features
Queue() has options for penalty, wrapuptime and priority have been added to the Asterisk queue system. Priority works like this, according to the contributor:The new addition provides the ability to operate queues as priority queues in addition to the current FIFO mode. This gives the ability to queue a call not at the end of the queue but anywhere in the queue, according to the call's priority.
Now you can have just one queue servicing all the calls (more important and less important) with the right order. The priority of a call entering a queue is determined by a special channel variable, QUEUE_PRIO. Higher values of this variable mean higher priority. By not setting this variable, all calls have the same priority, 0, by default (FIFO). E.g.
; Important clients
exten => 111,1,Playback(welcome)
exten => 111,2,SetVar(QUEUE_PRIO=10)
exten => 111,3,Queue(support)
; Less important clients
exten => 112,1,Playback(welcome)
exten => 112,2,SetVar(QUEUE_PRIO=5)
exten => 112,3,Queue(support)
Applications
- Asterisk cmd queue: Queue application, used in extensions.conf
- Asterisk cmd AddQueueMember: Dynamically add queue member
- Asterisk cmd RemoveQueueMember: Dynamically remove queue member
- Asterisk cmd PauseQueueMember: Pauses queue members (agent)
- Asterisk cmd UnpauseQueueMember: Unpauses queue members (agent)
- Asterisk cmd AgentLogin: Agent login to call queue
- Asterisk cmd AgentCallbackLogin: Another Login
CLI commands
- asterisk cli command show agents: Show agents
- show queues: List all queues
- show queue
: Show data on a specific queue
Configuration
- Asterisk config agents.conf: Configuration of call agents
- Asterisk config queues.conf: Configuration of call queues
Tutorials
- Asterisk Queues Tutorial (from Orderly Software).
200381 views strong.
See also
- Asterisk call parking
- Asterisk RealTime Queue
- Asterisk agents: More information on call agents
- Asterisk Queue Callback - Let your callers hangup while waiting for an agent without losing their place in line
- OrderlyQ - Extension to Asterisk Queues that lets callers hang up, then call back without losing their place.
- OrderlyStats - FREE Dedicated Real Time Call Centre Management and Statistics Package.
- Statistics that would be useful to add to this application: http://lists.digium.com/pipermail/asterisk-users/2003-July/014965.html
- QueueMetrics is a software package to analyze the queue_log file and extract a wealth of aggregate statistics on queue activities. The software is available for download and public trial.
- ASTELCENTER PHP Web solution which allows you to manage and supervise your ASTERISK PBX; generating reports and information in real time so clear and concrete; allows you to generate statistics and graphs: incoming calls, queue, session, outgoing calls, billing, ISP cost, and more; in order to improve the quality of services to their customers.
- Parse the queue log files and push them to a PostgreSQL database http://www.ekn.com/Logque.tar.gz.
- IPSwitchBoard BETA - Queue Log analyzer.
- Asterisk Queue Information
Comments
333Re: How do I use dynamic members without dropping to their voicemail?
333Calls being diverted to voicemail.
I have assigned the incoming call to that queue and both extensions ring - my problem is if one of the extentions is busy/diverted to voicemail; then the call gets passed to their voicemail - rather than just calling the other extention (s)
Basically all calls that are part of the queue should not be passed to any extensions personal voicemail? What have I missed?
333Multiple Queue Answer Sequence
I have written a couple of routines that overcome this limitation and will cause the queue with the call that has the longest hold time to be answered next. One version is for normal queues and one if you are using a queue callback like posted on this site. This routine requires that you use realtime queues to function. It monitors the queues and dynamically adjusts the queue weights so that the queue with the call having the longest wait time will be given preference and given to the next available agent, that is a member of that queue. This routine is not perfect since it only checks the queues and adjust the weights every few seconds. The delay or frequency that the queues are monitored is configurable.
Since agents may not be members of every queue, queueprio actually finds the two queues with the longest wait times and gives that queue a weight of 8, and the queue with the second longest wait time, a weight of 7, (the default weight given is 5) so that there is a reasonable chance that if the next available agent isn't a member of the queue with the longest wait, that agent may be a member of the queue with the second longest wait and will receive that call. If not, the agent will receive a call from one of the other queues. Again this routine isn't perfect - there are too many possible boundary conditions, so it is what I found to be the best compromise for our environment.
I need to find a place to post this routine but in the interim if you need a copy send me an email and I will sent it to you.
333Web display of queue (qview.pl) patch
Patch: http://www.3ait.co.uk/misc/qview.patch
Script: http://www.3ait.co.uk/misc/qview.txt (Rename to .pl)
333Ok... what about a 'roundrobin+ringall' ?
I mean, I have members A, B and C on a queue. Then when a call is there I want to: Dial A, then Dial A and B, then Dial A, B and C.
and when a new call arrives start again from the begginning. Any clues?
333Re: How do I use dynamic members without dropping to their voicemail?
333How do I use dynamic members without dropping to their voicemail?
1. Anybody in the company can log into the queue as an agent dynamically.
2. When nobody is logged in, drop directly to a special voicemail box.
3. When there are agents logged in, but not answering, users are STILL dropped to a special mailbox, not their own.
333Web display of queue (PERL)
See:
http://asterisk.toad.net/qview.pl
http://bugs.digium.com/bug_view_page.php?bug_id=0000236