Queue 
Asterisk for callcenters
         Asterisk for callcenters
 
         In an inbound callcenter scenario, the customers usually call to a certain number 
to ask for information, help etc.
An automated attendant will answer the phone, will give a warning that calls might 
be recorded for quality purposes and will allow the client to select some options 
through an IVR (interactive voice response.), such as language selection, what type 
of question they have etc.
The telephone system could then check if the call arrives during business hours 
and decide wether to call an agent phone or playback an automated message as "we 
are sorry, our offices are closed please call back in....", or even pass the customer 
on to an answering machine.
         19.1. Queues 
1. General information about telephony queues
         
Queues are used by the
						PSTN systems to 
         queue their customer’s 
						requests until free resources become available. This 
						means that if incoming traffic intensity levels exceed 
						available capacity, customer’s calls are here no longer 
						lost; the customers instead wait in line until they can 
						be served.[4] This method is used in queueing customers 
						for the next available operator.
A queueing discipline determines the manner in which the 
						exchange handles calls from customers.[4] It defines the 
						way they will be served, the order in which they are 
						served, and the way in which resources are divided 
						between the customers.
 2. Introducing to the Asterisk queues
       Enough information about the queues in general.
       Let’s talk about the queues which we will discuss 
						in the tutorial – Asterisk queues.
       At the beginning let’s say what are these Asterisk call
						queues. Asterisk queues are wealth! You 
						can do anything with the incoming calls using the queues. Have you ever wanted to route incoming calls 
						to another person, or to a []voicemail, without the 
						knowledge of the customer? With the Asterisk queues 
						you can balance incoming call workload among your 
						employees. Have you ever wanted one person to have more 
						priority in the calls, or a whole group of callers?
       The main Asterisk configuration files are located in 
						/etc/asterisk/. In this directory is located 
      queues.conf - /etc/asterisk/queues.conf.
       There are two possible ways to configure the settings in 
						this file.
       The first one, is the so called "static" way. For 
						this configuration you do not need the 
       
Example 
      
      This allows you to:  
         - call in, press 1, enter info and login 
							[check using CLI> show queue queue-name] 
							
- call in, press 1, enter info and logout 
							if already logged in [check using CLI> show 
							queue queue-name] 
- call in using any number other than the 
							callback number, press 3, queue yourself and 
							test the login 
So, from any single number, you can login all 
						your agents as members in any queue and test the 
						queues: just add your agent contact information 
						to the redundant context. 
In extensions.conf: 
[redundant] 
      
exten => 567,1,Dial(SIP/12223334444@sip-out-context,,Tr) 
						;this is the callback number 
[test] 
exten => s,1,Answer 
exten => s,n,Flite("Press one to add or remove 
						agent and three to queue yourself.") 
exten => s,n,WaitExten(10) 
      
exten => 1,1,Read(agext|enter-exten) ; in this 
						example enter-exten asks the agent for their 
						extension and agext=567 (see redundant context)
						
exten => 1,n,Macro(agent-add,queue-name,1111,${agext})
						
exten => 1,n,Hangup 
exten => 3,1,Queue(queue-name) 
exten => 3,2,Playback(goodbye) 
      
exten => 3,3,Hangup 
; Adds a dynamic agent/member to a Queue 
[macro-agent-add] 
      
exten => s,1,Wait(1) 
exten => s,n,GotoIf($["${ARG2}x" = "x"]?${MATH(${PRIORITY}+2)}:${MATH(${PRIORITY}+1)}) 
						; arg2 is queue password 
exten => s,n,Authenticate(${ARG2}) 
;exten => s,n(Add),AddQueueMember(${ARG1}|Local/${ARG3}@redundant/n) 
						;maybe SIP/12223334444@sip-out-context 
exten => s,n(Add),AddQueueMember(${ARG1}|Local/${ARG3}@redundant/n,,j) 
						;for priority jumping after and including 
						1.2.9.1 I believe 
exten => s,n,UserEvent(Agentlogin|Agent: 
						${ARG3}) 
exten => s,n,Wait(1) 
exten => s,n,Playback(agent-loginok) 
      
exten => s,n,Hangup() 
exten => 
						s,Add+101,Macro(agent-del,${ARG1},${ARG3}) 
; Removes a dynamic agent/member from a Queue
						
[macro-agent-del] 
exten => s,1,Wait(1) 
exten => s,n,RemoveQueueMember(${ARG1}|Local/${ARG2}@redundant/n)
						
exten => s,n,UserEvent(RefreshQueue) 
exten => s,n,Wait(1) 
exten => s,n,Playback(agent-loggedoff) 
      
exten => s,n,Hangup() 
See also: 
      
Asterisk call queues
      
      Asterisk cmd AddQueueMember
      
      Asterisk cmd RemoveQueueMember