quinta-feira, julho 01, 2010

Asterisk cmd Queue - voip-info.org

Asterisk cmd Queue - voip-info.org

Very usefull. How to work with queues using asterisk


Asterisk 1.6.0:

Asterisk 1.4:

Asterisk 1.0 through 1.2:

Queues an incoming call in a particular call queue as defined in queues.conf or dynamic realtime.

The option string may contain zero or more of the following characters:
  • d — data-quality (modem) call (minimum delay).
  • h — allow callee to hang up by pressing *.
  • H — allow caller to hang up by pressing *.
  • n — no retries on the timeout; will exit this application and go to the next step.
  • r — ring instead of playing MOH.
  • R — stops moh and rings once an agent is ringing (Asterisk Trunk)
  • t — allow the called user to transfer the calling user.
  • T — allow the calling user to transfer the call.
  • w — allow the called user to write the conversation to disk via Monitor.
  • W — allow the calling user to write the conversation to disk via Monitor.
  • c — continue in the dialplan if the callee hangs up (Asterisk 1.6.0 and above).
  • i — ignore call forward requests from queue members and do nothing when they are requested (Asterisk 1.6.0 and above).
  • k — Allow the called party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf (Asterisk 1.6.0 and above).
  • K — Allow the calling party to enable parking of the call by sending the DTMF sequence defined for call parking in features.conf (Asterisk 1.6.0 and above).
  • x — allow the called user to write the conversation to disk via MixMonitor (Asterisk 1.6.0 and above).
  • X — allow the calling user to write the conversation to disk via MixMonitor (Asterisk 1.6.0 and above).

In addition to transferring the call, a call may be parked and then picked up by another user.

'URL' allows you to specify a URL that will be sent to the called party if the channel supports it. You can also use an external application like QueueMetrics or Asteria Solutions Agent Client to launch the URL if your terminal does not support it.

  • In Asterisk 1.4, the optional AGI parameter will setup an AGI script to be executed on the calling party's channel once they are connected to a queue member.

'announceoverride' allows you to override the announcement specified in queues.conf using 'announce = ...' or add one to it in the first place.

'timeout' sets the time in seconds that a call will wait in the queue before it is routed to the next priority in the dialplan. It defaults to 300 seconds (5 minutes).

The timeout will cause the queue to fail out after a specified number of seconds, checked between each queues.conf 'timeout' and 'retry' cycle.
This application sets the following channel variable upon completion:

Note: This doesn't do what you think it should do (in 1.2.4 anyway). Once a call is inside a queue, it is only checked to see if it is timed out every so often (depending on the value of 'timeout=' for that queue in queues.conf). This means that if queues.conf says 'timeout=10' and you call the queue with 'Queue(queuename,,,,5)', it will be ten seconds before the call times out. If you call the Queue with 'Queue(queuename,,,,11)', it'll be 20 seconds. I.E. the value of 'timeout' supplied to the command DOES NOT override the value of 'timeout=' in queues.conf. Don't think about changing the value of 'timeout=' in queues.conf to, say, 1 or the calls will get offered to the members for only one second at a time.

This article attempts to explain this behavior. Note that this article states that the value of the 'timeout' parameter is absolute, which is not correct.

New in Asterisk 1.4: The MEMBERINTERFACE channel variable holds information about which queue member received the call. Variable is not available until you set 'setinterfacevar=' to 'yes' in queues.conf.
Note: This parameter must be wrote INSIDE of each queue, not in the general context because it won't work.

Return codes

This application returns -1 if the originating channel hangs up, or if the call is bridged and either of the parties in the bridge terminate the call. Returns 0 if the queue is full, nonexistent, or has no members.

This method only works when there are no members defined in queues.conf, and instead only added with AddQueueMember(). However with "Member => Agent/101" in queues.conf the Queue command always returns as if there were a member.
Update: 'leavewhenempty = yes' in queues.conf fixes this (in CVS since Sep 28, 2004)


  • If 'persistentmembers = yes' is used in queues.conf, dynamically added agents are saved in the Asterisk Berkeley database, and are preserved across restart. If not, dynamically added agents are lost upon Asterisk restart.
  • Use the 'Local' channel construct to point to an appropriate dial-out extension in the dialplan if you'd like to add remote agents using AgentCallbackLogin()
  • Transfers of calls that are answered out of a queue must be done using Asterisk '#' transfers (enabled with the 't' option above). SIP transfers result in the Agent remaining affiliated with the call until its eventual termination, preventing that agent from being offered another call.
  • The application sets the following channel variable upon completion: QUEUESTATUS. The status of the call as a text string, one of TIMEOUT, FULL, JOINEMPTY, LEAVEEMPTY, JOINUNAVAIL, or LEAVEUNAVAIL.
  • A member assigned to a queue ("member => Agent/1234" for example) can be a phone (e.g. "member => SIP/phone1").
  • Check the timeout settings of your extensions involved in the queue.
  • Snom Phones have in their web interface an "invisible" timeout of 60 seconds. The Playback command, even if an empty file is played, seems to help in avoiding a call being dropped after 60 seconds.


Example 1: Basics

exten => s,1,Answer
exten => s,2,SetMusicOnHold(default)
exten => s,3,DigitTimeout,5
exten => s,4,ResponseTimeout,10
exten => s,5,Background(welcome)
exten => s,6,Queue(tech-queue)

The s,1,Answer is important in order not to have ringing in the background of your hold music.

Example 2: Use BLF LED to show queue login status of an agent

Look at this post (in German), requires bristuff'ed Asterisk 1.2 or 1.4

Example 3

Here is a working queue-solution as example:

A call comes in over a sip channel, is routed to the extension which handles the example-queue (here extension 129) in the context example-queue in extensions.conf. The call, if not answered by an agent, should remain for 300 seconds in the queue, before it is routed to the next priority which transfers the call to voicemail.
The called and the calling user are able to transfer the call (tT as options of the queue command in extensions.conf).

Signaling the call to logged on agents should work like this:

After the first priority "Playback(some_announce)" has finished, all agents should be signalled (ringall in queues.conf) for at least 15 seconds (timeout in queues.conf). The caller should hear music on hold in the meanwhile. If the call wasn't answered by an agent, there should be some time before the call is signalled again (retry in queues.conf). The actual queue position is announced to the caller every 30 seconds (announce-frequency and announce-holdtime in queues.conf).


exten => 129,1,Playback(some_announce) ; Important, see notes
exten => 129,2,Queue(example_queue|tT|||300) ;dont set n option until really needed
exten => 129,3,Playback(some_announce_after_leaving_queue)
exten => 129,4,Voicemail(s1234)


music = default
strategy = ringall
context = queue-out ; Here we go when the caller presses a single digit, while in the queue
timeout = 15
announce-frequency = 30
announce-holdtime = yes
joinempty = yes
member => Agent/1234
member => Agent/1235


ackcall=no ; Agent does NOT have to press # to answer the call
musiconhold => default
agent => 1234,0000,Agent1_Name
agent => 1235,0000,Agent2_Name

See also

  • Function QUEUE_MEMBER_COUNT: Count number of members answering a queue
  • Function QUEUE_MEMBER_LIST: Returns a comma-separated list of members associated with the specified queue
  • Function QUEUE_WAITING_COUNT: Count number of calls currently waiting in a queue
  • Asterisk call queues
  • Asterisk config queues.conf
  • Applications used: Answer | SetMusicOnHold | DigitTimeout | ResponseTimeout | Background
  • Asterisk RealTime Queue, to store queues in a database with automatic update of changes (no need for explicit reload).
  • Asterisk agents
  • Asterisk Queue Callback - Dialplan and Perl script to allow your callers to hang up without losing their place in the queue.
  • Function DIALGROUP: New in 1.6: Poor man's calling queue
  • Queue-Tip - Opensource (GPL) Asterisk Queue Monitoring and Reporting suite using Adhearsion and Ruby on Rails.
  • OrderlyQ - Extension to Asterisk Queues that lets callers hang up, then call back without losing their place.
  • OrderlyStats - FREE Dedicated Real Time Call Centre Management and Statistics Package.
  • app_icd: Look at ICD if you desire a more customizable queue and call center solution
  • IPSwitchBoard BETA - Queue Log Analyzer
  • QueueMetrics is a software package to analyze the queue_log file and extract a wealth of aggregate statistics on queue activities. The software is available for download and public trial.
  • Asteriskguru Queue Statistics - The Asteriskguru queue statistics, is a PHP based program, which gives anyone who uses queues or CDRs overview in Asterisk a deep insight in the quality of the service which is delivered to their customers.
  • AstQueueIcon: Alternative free queue solution utilitzing the call parking feature instead of the queue application. As the queue app stays out of the media path, features like call forwarding will not be denied for the agents.
  • Asterisk Queues Tutorial (from Orderly Software).
  • 1.6.x Patch to add ringing: Adds optional support for giving ringing indication when the queue finds a member/agent to call. (as opposed to always playing MOH)

Nenhum comentário: