login | register
Fri 29 of Aug, 2008 [01:29 UTC]

voip-info.org

History

Asterisk cmd Queue

Created by: oej,Last modification on Mon 04 of Aug, 2008 [13:27 UTC] by JustRumours

Synopsis

Queue a call for a call queue

Description

Asterisk 1.6.0:
 Queue(queuename[,options][,URL][,announceoverride][,timeout][,AGI][,macro][,gosub][,rule])

Asterisk 1.4:
 Queue(queuename[|options][|URL][|announceoverride][|timeout][|AGI])

Asterisk 1.0 through 1.2:
 Queue(queuename[|options][|URL][|announceoverride][|timeout])

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.
  • 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:
     QUEUESTATUS   The status of the call as a text string, one of TIMEOUT | FULL | JOINEMPTY | LEAVEEMPTY | JOINUNAVAIL | LEAVEUNAVAIL


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



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)

Notes

  • 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.

Examples

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).

extensions.conf:

[queue]
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)

queues.conf:

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

agents.conf:

[agents]
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 Asterisk func 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
  • 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).


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ


Comments

Comments Filter
222

333QUEUESTATUS

by manuna, Friday 28 of September, 2007 [07:44:48 UTC]
I noticed, that if i call to a queue and the queue side answers and then hangs up, QUEUESTATUS variable is set to null (or just not set may be). It is * 1.2.14, and i wonder if it is correct behaviour, because i have to determine if callee hanged up.
222

333Using r in Queue command

by vgster, Friday 03 of August, 2007 [13:25:36 UTC]
Would appear that using it does do the ring instead of playing the MOH but also it ignores any announcement settings.
222

333Extended RRMEMORY strategy

by dnz63, Tuesday 27 of February, 2007 [22:26:28 UTC]
As for now if RRMEMORY startegy is chosen Queue calls only members with lowest penalty. It will never call member if any member with lower penalty is available, even if it doesn't answer.

For example, we have 4 members in queue:

Member 1 with Penalty 0
Member 2 with Penalty 0
and
Member 3 with Penalty 1
Member 4 with Penalty 1

Member 3 & 4 will never be called if Member 1 and Member 2 don't answer the phone. Queue will try to call Member 1 and Member 2 forever.

I added new strategy called XRRMEMORY which can be chosen in queue.conf. Using this strategy Queue will try all members with penalty=0 then it will try members with penalty=1 and so on. Moreover it remembers the members it called last time for each peanlty and next time if it reaches this penalty it will dial next member.

This strategy support penalty from 0 to 9 (you can change #define MAX_QUEUE_PENALTY 9 constant in app_queue.c)

http://cs.mcn.ru/blogs/dnz63_weblog/archive/2007/02/28/Queue_3A00_-Extended-RRMEMORY-strategy.aspx
222

333queue and still queued

by jdovejr, Monday 26 of February, 2007 [00:23:38 UTC]
i did this to emulate Avaya queuing by creating a queued and still-queued actions (still-queued is when you cycle around a queue and a timeout hits). this takes you to the next step that gives the user a chance to leave a voicemail for the next available agent (distributed to all via email) to call them back. It also has a failsafe so if the people leave and someone calls in , it will take them to voicemail after 5 minutes to request a callback. this goes into extensions.conf:

Also note how i did the caller id in the 5th step so that people who are answering the phone know that it is a support call. This is good when single agents answer calls for multiple departments or corporate identities.

The caller id shows up as:

name: Support>Blah Blah Caller
num: 555-555-1212

you will need to create an audio file call queueoptout and give the caller the option to press 1 to leave a message or continue to hold

default
exten => 4632,1,GoTo(support,s,1)

support
exten => s,1,Ringing
exten => s,n,Wait,3
exten => s,n,Answer
exten => s,n,Set(num=1)
exten => s,n,Set(CALLERID(name)=Support>${CALLERID(name)})
exten => s,n,Queue(support,t,,,15)
exten => s,n,Set(num1=${MATH(${num}+1,int)})
exten => s,n,Set(num=${num1})
exten => s,n,GotoIf($"${num1}" = "6"?13:10)
exten => s,n,Background(queueoptout)
exten => s,n,Queue(support,t,,,60)
exten => s,n,Goto(s,7)
exten => s,n,Voicemail(4602,u)
;
;
exten => 1,1,Voicemail(4602,u)
222

333queue and still queued

by jdovejr, Monday 26 of February, 2007 [00:22:01 UTC]
i did this to emulate Avaya queuing by creating a queued and still-queued actions (still-queued is when you cycle around a queue and a timeout hits). this takes you to the next step that gives the user a chance to leave a voicemail for the next available agent (distributed to all via email) to call them back. It also has a failsafe so if the people leave and someone calls in , it will take them to voicemail after 5 minutes to request a callback. this goes into extensions.conf:

Also note how i did the caller id in the 5th step so that people who are answering the phone know that it is a support call. This is good when single agents answer calls for multiple departments or corporate identities.

The caller id shows up as:

name: Support>Blah Blah Caller
num: 555-555-1212

you will need to create an audio file call queueoptout and give the caller the option to press 1 to leave a message or continue to hold

default
exten => 4632,1,GoTo(support,s,1)

support
exten => s,1,Ringing
exten => s,n,Wait,3
exten => s,n,Answer
exten => s,n,Set(num=1)
exten => s,n,Set(CALLERID(name)=Support>${CALLERID(name)})
exten => s,n,Queue(support,t,,,15)
exten => s,n,Set(num1=${MATH(${num}+1,int)})
exten => s,n,Set(num=${num1})
exten => s,n,GotoIf($"${num1}" = "6"?13:10)
exten => s,n,Background(queueoptout)
exten => s,n,Queue(support,t,,,60)
exten => s,n,Goto(s,7)
exten => s,n,Voicemail(4602,u)
;
;
exten => 1,1,Voicemail(4602,u)
222

333Documentation for "optionalurl" option

by desktophero, Wednesday 31 of August, 2005 [15:11:24 UTC]
Does anyone have working examples of the optionalurl option in the Queue cmd? Perhaps a list of devices that support this option.

Thank you.
222

333valid extension / exiting from queue

by ojaksch, Monday 11 of April, 2005 [14:35:59 UTC]
Seems, that a valid extension (i.e. "exten => s,4,queue(bla|tT|||60)" ) MUST be present.
Tested with extension "exten => _.,4,queue(bla|tT|||60)" wich is working, but exits to a "queue-loop".

Afterwards, this makes sense: sending "hangup" to terminate a queue results in an errorlevel of "non zero" which results in reentering the extension "_." (answer REALLY ALL - including errorlevel, i.e. for error-handling)

Any confirmations?
222

333Documentation for "announceoverride" option

by , Thursday 10 of February, 2005 [19:54:19 UTC]
Can somebody add some documentation for the announceoverride option?

What does it do? Is it used to disable announcements, override announcement frequency, or override the announcement recording itself?

Thanks.