login | register
Thu 28 of Aug, 2008 [03:58 UTC]

voip-info.org

History

Asterisk call queues

Created by: oej,Last modification on Wed 06 of Aug, 2008 [03:11 UTC] by k6antar

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


CLI commands

  • asterisk cli command show agents: Show agents
  • show queues: List all queues
  • show queue : Show data on a specific queue



Configuration


Tutorials


200381 views strong.


See also





Comments

Comments Filter
222

333Re: How do I use dynamic members without dropping to their voicemail?

by lukedawson, Thursday 20 of September, 2007 [14:21:39 UTC]
I accomplish this with dynamic queue members that map to a Local channel. For example, logging on an interface as Local/1NNN@queue-agent/n, and using Dial(SIP/${EXTEN:1}) (my SIP extensions are in the format NNN) in the relevant extension in the queue-agent context - that way a busy or unavailable agent will bounce back to the queue rather than to a voicemail as it would using the stdexen macro. Why the 1 prefix? Well, since I want agents to be able to transfer calls to other extensions, were you to use the real extension, such a transfer would hit the pattern match for the Local extension, whereas in this circumstance I want to use the stdexten macro. And since Queue() will return and move onto the next priority in the extension if the queue is empty or the timeout is reached, my Queue priority + 1 drops into a voicemail box, thus achieving I believe all three results you desire. And it only took two years to get a response!
222

333Calls being diverted to voicemail.

by instinct, Monday 17 of September, 2007 [11:21:39 UTC]
I am not sure if I have mis-understood if this is possible but I am trying to implement a ringall strategy, which in it's simplest form has 2/3 extenstions (declared in agents.conf/queues.conf).

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?
222

333Multiple Queue Answer Sequence

by linuxppcguy, Thursday 25 of January, 2007 [16:58:55 UTC]
If you are using multiple queues you should be aware that - Asterisk currently has no way of prioritizing calls in queues, to guarantee that the queue with the call that has the longest hold time will be answered next. If Asterisk is configured with several queues and all queues have calls waiting, when an Agent becomes available, Asterisk randomly picks the queue that will be answered next. This can be a problem adversely affecting service levels since the queue with the call having the longest hold time may be essentially ignored for several cycles of available agents.

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.
222

333Web display of queue (qview.pl) patch

by cbkm2k6, Monday 10 of July, 2006 [14:43:40 UTC]
While doing work for a client we noticed that qview.pl didn't seem to be working anymore (in 1.2.9.1 - probably earlier as well), the following patch / new version that we created should fix this:-

Patch: http://www.3ait.co.uk/misc/qview.patch
Script: http://www.3ait.co.uk/misc/qview.txt (Rename to .pl)
222

333Ok... what about a 'roundrobin+ringall' ?

by telenieko, Monday 26 of September, 2005 [17:15:30 UTC]
I explain, I need to be able to call all members of a queue in turn but without leaving to ring the previous one.

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?
222

333Re: How do I use dynamic members without dropping to their voicemail?

by , Wednesday 05 of January, 2005 [02:30:59 UTC]
by "their own" I mean one of the agent's voicemail boxes.
222

333How do I use dynamic members without dropping to their voicemail?

by , Wednesday 05 of January, 2005 [02:30:02 UTC]
How do I accomplish the following?
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.
222

333Web display of queue (PERL)

by , Thursday 27 of November, 2003 [18:06:13 UTC]
Script provides mechanism for viewing queues through a webserver. Simple but effective.

See:
http://asterisk.toad.net/qview.pl
http://bugs.digium.com/bug_view_page.php?bug_id=0000236