2006-09-25 - VoIPowering Your Office with Asterisk: Call Queues
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 groups—groups of extensions assigned to a single extension, like this: 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.
[customer-service] exten => 666,1,Dial(SIP/604&SIP/605&SIP/606,40,tr) exten => 666,2,VoiceMail(s699@local-vm-users)
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: 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 : 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.
agent => 1010,1122,Fred Calmguy agent => 1011,2233,Ellen Soothing agent => 1012,3344,Elizabeth Fixproblems
;agent phones for calling queues [5656] type=friend username=5656 secret=[password] host=dynamic [6767] type=friend username=6767 secret=[password] host=dynamic
Then add each phone to the appropriate context in /etc/asterisk/extensions.conf. This examples uses the [queues] context: You'll want to add the [queues] context to the appropriate incoming context that your agents are using: At this point you can issue a reload command to Asterisk, then dial the new extensions to make sure they work: Now edit /etc/asterisk/queues.conf to define the actual queue: You can set up as many different queues as you want in this file.
[queues] exten => 5656,1,Dial(SIP/5656) exten => 6767,1,Dial(SIP/6767)
include => queues
asterisk1*CLI> reload asterisk1*CLI> dial 5656@queues
[queue1] music=default strategy=ringall timeout=15 retry=5 wrapuptime=10 announce = queue-queue1 maxlen = 20 announce-frequency = 60 announce-holdtime = yes member => Agent/1010 member => Agent/1011 member => Agent/1012
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: 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.
include => queue1
;queue 1 exten=> 2050,1,Answer exten=> 2050,2,Ringing exten=> 2050,3,Wait(2) exten=> 2050,4,Queue(queue1)
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 unnecessary delays.
;Agent Login
exten=> 2011,1,AgentCallbackLogin(||${CALLERIDNUM}@queues)
;Agent Logout
exten=> 2012,1,AgentCallbackLogin(||l)
By Carla Shroeder
Signup here for your free news on new products and voip