Automatic Call Distribution (ACD) Queues(part-1)[*ASTERISK*]

Automatic Call Distribution Queues

Automatic Call Distribution (ACD), or call queuing, provides a way for a PBX to queue up incoming calls from a group of users: it aggregates multiple calls into a holding pattern, assigns each call a rank, and determines the order in which that call should be delivered to an available agent (typically, first in first out). When an agent becomes available, the highest-ranked caller in the queue is delivered to that agent, and everyone else moves up a rank.
**Important point–

There are two types of call centers: inbound and outbound. ACD refers to the technology that handles inbound call centers, whereas the term Dialer (or Predictive Dialer) refers to the technology that handles outbound call centers. In this book we will primarily focus on inbound calling.

Creating a Simple ACD Queue

To start with, we’re going to create a simple ACD queue. It will accept callers and attempt to deliver them to a member of the queue.
We’ll create the queue(s) in the queues.conf file, and manually add queue members to it through the Asterisk console.
The first step is to create an empty agents.conf file in your /etc/asterisk configuration directory. We will not use or edit this file, however the app_queue module expects to find it, and will not load if it does not exist:
          $ cd /etc/asterisk
          $ touch agents.conf
Next you need to create the queues.conf file, which is where configuration for the actual queues is defined:
          $touch queues.conf
Populate it with the following configuration, which will create two queues named [sales] and [support].
[general]
autofill=yes                   ;  distribute all waiting callers to available members
shared_lastcall=yes       ;  respect the wrapup time for members logged into more
                                     ;  than one queu
[StandardQueue](!)      ; template to provide common features
musicclass=default       ; play [default] music
strategy=rrmemory       ; use the Round Robin Memory strategy
joinempty=no               ; do not join the queue when no members available
leavewhenempty=yes   ; leave the queue when no members available
ringinuse=no                 ; don’t ring members when already InUse (prevents
                                      ; multiple calls to an agent)
[sales](StandardQueue)       ; create the sales queue using the parameters in the
                                            ; StandardQueue template
[support](StandardQueue)   ; create the support queue using the parameters in the
                                            ; StandardQueue template
The [general] section defines the default behavior and global options. We’ve only specified two options in the [general] section, since the built-in defaults are sufficient for our needs at this point.
The first option is autofill, which tells the queue to distribute all waiting callers to all available members immediately. Previous versions of Asterisk would only distribute one caller at a time, which meant that while Asterisk was signaling an agent, all other calls were held (even if other agents were available) until the first caller in line had been connected to an agent (which obviously led to bottlenecks in older versions of Asterisk where large, busy queues were being used). Unless you have a particular need for

backward-compatibility, this option should always be set to yes.
The second option in the [general] section of queues.conf is shared_lastcall. When we enable shared_lastcall , the last call to an agent who is logged into multiple queues will be the call that is counted for wrapup time in order to avoid sending a call to an
agent from another queue during the wrap period. If this option is set to no , the wrap timer will only apply to the queue the last call came from, which means an agent who was wrapping up a call from the support queue might still get a call from the sales queue. This option should also always be set to yes (the default).
The next section, [StandardQueue](!) is the template we’ll apply to our sales and sup‐ port queues (we declared it a template by adding(!)). We’ve defined the musicclass to be the default music on hold, as configured in the musiconhold.conf file. The strategy
we’ll employ is rrmemory, which stands for Round-Robin with Memory. The rrmemory strategy works by rotating through the agents in the queue in sequential order, keeping track of which agent got the last call, and presenting the next call to the next agent. When it gets to the last agent, it goes back to the top (as agents log in, they are added to the end of the list). We’ve set joinempty to
no since it is generally bad form to put callers into a queue where there are no agents available to take their calls.
The leavewhenempty option is used to control whether callers should fall out of the Queue() application and continue on in the dialplan if no members are available to take their calls. We’ve set this to yes because you won’t normally want callers waiting in a
queue with no logged-in agents.
Finally, we’ve set ringinuse to no, which tells Asterisk not to ring members when their devices are already ringing. The purpose of setting ringinuse to no is to avoid multiple calls to the same member from one or more queues.
Once you’ve finished configuring your queues.conf file, you can save it and reload the app_queue.so module from your Asterisk CLI:
$ asterisk -r
*CLI> module reload app_queue.so
— Reloading module ‘app_queue.so’ (True Call Queueing)
Then verify that your queues were loaded into memory (don’t forget to ensure an empty agents.conf file exists as well):
localhost*CLI> queue show
support has 0 calls (max unlimited) in ‘rrmemory’ strategy
(0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
No Members
No Callers
sales has 0 calls (max unlimited) in ‘rrmemory’ strategy
(0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0% within 0s
No Members
No Callers
The output of queue show provides various pieces of information, including those parts detailed in Table:
Table  Output of queue show CLI command
Field      Description
W:          Queue weight
C:           Number of calls presented to this queue
A:           Number of calls that have been answered by a member
SL:         Service level
Now that you’ve created the queues, you need to configure your dialplan to allow calls to enter the queue.
Add the following dialplan logic to the extensions.conf file:
[Queues]
exten => 7001,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Queue(support)
same => n,Hangup()
exten => 7002,1,Verbose(2,${CALLERID(all)} entering the sales queue)
same => n,Queue(sales)
same => n,Hangup()
[LocalSets]
include => Queues ; allow phones to call queues
We’ve included theQueues context in the LocalSets context so that our telephones can call the queues we’ve set up.