Today we shall set up calling queues so that callers who are very important to us will be handled by the next available representative. This replaces ring groups. Last week we learned how to set up ring groupsgroups of extensions assigned to a single extension, like this:
exten => 666,1,Dial(SIP/604&SIP/605&SIP/606,40,tr)
exten => 666,2,VoiceMail(s699@local-vm-users)
Dialing extension 666 rings all the extensions named in the Dial command,
the theory being that the first available representative picks up and handles
the call. (Asterisk can only provide the tools; it does not enforce behavior.)
In this particular [customer-service] context, callers are routed to voicemail
if no one answers the call.
When timely response is deemed more critical, you'll want to replace this [customer-service] context with a proper calling queue.
First fire up your trusty text editor and open /etc/asterisk/agents.conf.
Add entries to the file for all the people, or "agents," who are going to answer
calls from the queue. List their extensions, passwords, and names:
agent => 1010,1122,Fred Calmguy
agent => 1011,2233,Ellen Soothing
agent => 1012,3344,Elizabeth Fixproblems
Next, we'll set up Asterisk up for "hotdesking," which means any agent can use any phone available to the agents. First add the queue phones to /etc/asterisk/sip.conf. Unlike phones assigned directly to users (see VoIPowering Your Office with Asterisk: SOHO VoIP, Part 2), agent phones will be given numbers instead of user's names. This example shows two extensions. Replace [password] with real passwords :
;agent phones for calling queues
We're assuming you're using SIP phones. If you're not using SIP phones,
find and edit the appropriate file for your type of phones.
Then add each phone to the appropriate context in /etc/asterisk/extensions.conf. This examples uses the [queues] context:
exten => 5656,1,Dial(SIP/5656)
exten => 6767,1,Dial(SIP/6767)
You'll want to add the [queues] context to the appropriate incoming context that your agents are using:
include => queues
At this point you can issue a reload command to Asterisk, then dial the new extensions to make sure they work:
asterisk1*CLI> dial 5656@queues
Now edit /etc/asterisk/queues.conf to define the actual queue:
announce = queue-queue1
maxlen = 20
announce-frequency = 60
announce-holdtime = yes
member => Agent/1010
member => Agent/1011
member => Agent/1012
You can set up as many different queues as you want in this file.
You can create several different music classes in /etc/asterisk/musiconhold.conf, and then name the one you want to use with the music directive.
strategy defines which ringing pattern to use. The default is to ring all agents at once.
timeout defines how many seconds to ring before retrying.
retry tells how many seconds to wait before trying again.
wrapuptime sets how many seconds to wait after an agent completes a call before the next caller rings through.
announce announce the queue name to the agent when s/he answers the call. If agents are attending to multiple queues, this should be enabled.
maxlen limits the number of callers in the queue.
announce-frequency determines how often callers will hear the default "All reps are busy" announcements.
announce-holdtime options are Yes, No, or Once if you want callers to hear their estimated hold times.
The queues.conf file explains all of the options and the defaults in more detail.
Now add this queue to the [queues] context:
include => queue1
The next step is to create an extension for routing incoming calls to the queue:
If you need your memory refreshed on how to set up an incoming context,
refer to VoIPowering
Your Office with Asterisk: SOHO VoIP, Part 5.
Finally, create an extension that agents can dial to login to go to work, and another one to logout when they are finished:
Agents must remember to log out or their extensions will continue to ring
when they're not there. If you're using ringall, which is the default,
this is merely annoying. But if you are using any other ring strategy such as
roundrobin, leastrecent, or fewestcalls, callers are going to experience
Next week, by popular demand, we're going to learn how to get SIP calls through NAT firewalls. SIP is a great protocol; in fact you don't even need a PBX to make SIP calls over the Internet. All you need is a SIP phone (or softphone) and a service like Gizmo Project. But SIP is a complex protocol, and trying to get through a NAT firewall has driven more than one admin to despair. But fear not, it can be done, as you shall see next week.
VoIPowering Your Office with Asterisk: Soothing the Savages with Hold Music
VoIPowering Your Office With Asterisk: Moving to the Grownup Version tells how to start and stop Asterisk
Index to the entire Asterisk series