Skip to content
Snippets Groups Projects
app_queue.c 331 KiB
Newer Older
  • Learn to ignore specific revisions
  • Mark Spencer's avatar
    Mark Spencer committed
    /*
    
     * Asterisk -- An open source telephony toolkit.
    
    Mark Spencer's avatar
    Mark Spencer committed
     *
    
     * Copyright (C) 1999 - 2006, Digium, Inc.
    
    Mark Spencer's avatar
    Mark Spencer committed
     *
    
     * Mark Spencer <markster@digium.com>
    
    Mark Spencer's avatar
    Mark Spencer committed
     *
    
     * See http://www.asterisk.org for more information about
     * the Asterisk project. Please do not directly contact
     * any of the maintainers of this project for assistance;
     * the project provides a web site, mailing lists and IRC
     * channels for your use.
     *
     * This program is free software, distributed under the terms of
     * the GNU General Public License Version 2. See the LICENSE file
     * at the top of the source tree.
     */
    
    
     * \brief True call queues with optional send URL on answer
    
     * \author Mark Spencer <markster@digium.com>
     *
    
    Russell Bryant's avatar
    Russell Bryant committed
     * \par Development notes
    
     * \note 2004-11-25: Persistent Dynamic Members added by:
    
     *             NetNation Communications (www.netnation.com)
     *             Kevin Lindsay <kevinl@netnation.com>
    
    Tilghman Lesher's avatar
    Tilghman Lesher committed
     *
    
     *             Each dynamic agent in each queue is now stored in the astdb.
     *             When asterisk is restarted, each agent will be automatically
     *             readded into their recorded queues. This feature can be
    
     *             configured with the 'persistent_members=<1|0>' setting in the
     *             '[general]' category in queues.conf. The default is on.
    
    Tilghman Lesher's avatar
    Tilghman Lesher committed
     *
    
     * \note 2004-06-04: Priorities in queues added by inAccess Networks (work funded by Hellas On Line (HOL) www.hol.gr).
    
     * \note These features added by David C. Troy <dave@toad.net>:
    
     *    - Per-queue holdtime calculation
     *    - Estimated holdtime announcement
     *    - Position announcement
     *    - Abandoned/completed call counters
     *    - Failout timer passed as optional app parameter
     *    - Optional monitoring of calls, started when call is answered
     *
     * Patch Version 1.07 2003-12-24 01
     *
     * Added servicelevel statistic by Michiel Betel <michiel@betel.nl>
    
     * Added Priority jumping code for adding and removing queue members by Jonathan Stanton <asterisk@doilooklikeicare.com>
    
     * Fixed to work with CVS as of 2004-02-25 and released as 1.07a
    
     * by Matthew Enger <m.enger@xi.com.au>
     *
    
    Russell Bryant's avatar
    Russell Bryant committed
     * \ingroup applications
    
    /*! \li \ref app_queues.c uses configuration file \ref queues.conf
    
    Andrew Latham's avatar
    Andrew Latham committed
     * \addtogroup configuration_file
     */
    
    /*! \page queues.conf queues.conf
     * \verbinclude queues.conf.sample
     */
    
    
    /*** MODULEINFO
    
    	<use type="module">res_monitor</use>
    
    	<support_level>core</support_level>
    
    #include "asterisk.h"
    
    ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
    
    
    #include <sys/time.h>
    #include <sys/signal.h>
    #include <netinet/in.h>
    
    #include "asterisk/lock.h"
    #include "asterisk/file.h"
    #include "asterisk/channel.h"
    #include "asterisk/pbx.h"
    
    #include "asterisk/app.h"
    #include "asterisk/linkedlists.h"
    
    #include "asterisk/module.h"
    #include "asterisk/translate.h"
    #include "asterisk/say.h"
    #include "asterisk/features.h"
    #include "asterisk/musiconhold.h"
    #include "asterisk/cli.h"
    #include "asterisk/manager.h"
    #include "asterisk/config.h"
    #include "asterisk/monitor.h"
    #include "asterisk/utils.h"
    #include "asterisk/causes.h"
    #include "asterisk/astdb.h"
    
    #include "asterisk/stringfields.h"
    
    #include "asterisk/astobj2.h"
    
    #include "asterisk/global_datastores.h"
    
    #include "asterisk/taskprocessor.h"
    
    #include "asterisk/aoc.h"
    
    #include "asterisk/cel.h"
    
    #include "asterisk/data.h"
    
    #include "asterisk/term.h"
    
    #include "asterisk/dial.h"
    #include "asterisk/stasis_channels.h"
    
    #include "asterisk/stasis_message_router.h"
    
    /* Define, to debug reference counts on queues, without debugging reference counts on queue members */
    /* #define REF_DEBUG_ONLY_QUEUES */
    
    
    /*!
     * \par Please read before modifying this file.
    
     * There are three locks which are regularly used
     * throughout this file, the queue list lock, the lock
     * for each individual queue, and the interface list lock.
     * Please be extra careful to always lock in the following order
     * 1) queue list lock
     * 2) individual queue lock
     * 3) interface list lock
     * This order has sort of "evolved" over the lifetime of this
     * application, but it is now in place this way, so please adhere
     * to this order!
     */
    
    
    /*** DOCUMENTATION
    	<application name="Queue" language="en_US">
    		<synopsis>
    			Queue a call for a call queue.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="options">
    				<optionlist>
    
    					<option name="C">
    						<para>Mark all calls as "answered elsewhere" when cancelled.</para>
    					</option>
    
    					<option name="c">
    						<para>Continue in the dialplan if the callee hangs up.</para>
    					</option>
    					<option name="d">
    						<para>data-quality (modem) call (minimum delay).</para>
    					</option>
    
    					<option name="F" argsep="^">
    						<argument name="context" required="false" />
    						<argument name="exten" required="false" />
    						<argument name="priority" required="true" />
    						<para>When the caller hangs up, transfer the <emphasis>called member</emphasis>
    						to the specified destination and <emphasis>start</emphasis> execution at that location.</para>
    						<note>
    							<para>Any channel variables you want the called channel to inherit from the caller channel must be
    							prefixed with one or two underbars ('_').</para>
    						</note>
    					</option>
    					<option name="F">
    						<para>When the caller hangs up, transfer the <emphasis>called member</emphasis> to the next priority of
    						the current extension and <emphasis>start</emphasis> execution at that location.</para>
    						<note>
    							<para>Any channel variables you want the called channel to inherit from the caller channel must be
    							prefixed with one or two underbars ('_').</para>
    						</note>
    						<note>
    							<para>Using this option from a Macro() or GoSub() might not make sense as there would be no return points.</para>
    						</note>
    					</option>
    
    					<option name="h">
    						<para>Allow <emphasis>callee</emphasis> to hang up by pressing <literal>*</literal>.</para>
    					</option>
    					<option name="H">
    						<para>Allow <emphasis>caller</emphasis> to hang up by pressing <literal>*</literal>.</para>
    					</option>
    					<option name="n">
    						<para>No retries on the timeout; will exit this application and
    						go to the next step.</para>
    					</option>
    					<option name="i">
    						<para>Ignore call forward requests from queue members and do nothing
    						when they are requested.</para>
    					</option>
    
    					<option name="I">
    						<para>Asterisk will ignore any connected line update requests or any redirecting party
    						update requests it may receive on this dial attempt.</para>
    					</option>
    
    					<option name="r">
    						<para>Ring instead of playing MOH. Periodic Announcements are still made, if applicable.</para>
    					</option>
    
    					<option name="R">
    						<para>Ring instead of playing MOH when a member channel is actually ringing.</para>
    					</option>
    
    					<option name="t">
    						<para>Allow the <emphasis>called</emphasis> user to transfer the calling user.</para>
    					</option>
    					<option name="T">
    						<para>Allow the <emphasis>calling</emphasis> user to transfer the call.</para>
    					</option>
    					<option name="w">
    						<para>Allow the <emphasis>called</emphasis> user to write the conversation to
    						disk via Monitor.</para>
    					</option>
    					<option name="W">
    						<para>Allow the <emphasis>calling</emphasis> user to write the conversation to
    						disk via Monitor.</para>
    					</option>
    					<option name="k">
    						<para>Allow the <emphasis>called</emphasis> party to enable parking of the call by sending
    						the DTMF sequence defined for call parking in <filename>features.conf</filename>.</para>
    					</option>
    					<option name="K">
    						<para>Allow the <emphasis>calling</emphasis> party to enable parking of the call by sending
    						the DTMF sequence defined for call parking in <filename>features.conf</filename>.</para>
    					</option>
    					<option name="x">
    						<para>Allow the <emphasis>called</emphasis> user to write the conversation
    						to disk via MixMonitor.</para>
    					</option>
    					<option name="X">
    						<para>Allow the <emphasis>calling</emphasis> user to write the conversation to
    						disk via MixMonitor.</para>
    					</option>
    				</optionlist>
    			</parameter>
    			<parameter name="URL">
    				<para><replaceable>URL</replaceable> will be sent to the called party if the channel supports it.</para>
    			</parameter>
    			<parameter name="announceoverride" />
    			<parameter name="timeout">
    				<para>Will cause the queue to fail out after a specified number of
    				seconds, checked between each <filename>queues.conf</filename> <replaceable>timeout</replaceable> and
    				<replaceable>retry</replaceable> cycle.</para>
    			</parameter>
    			<parameter name="AGI">
    				<para>Will setup an AGI script to be executed on the calling party's channel once they are
    				connected to a queue member.</para>
    			</parameter>
    			<parameter name="macro">
    				<para>Will run a macro on the calling party's channel once they are connected to a queue member.</para>
    			</parameter>
    			<parameter name="gosub">
    				<para>Will run a gosub on the calling party's channel once they are connected to a queue member.</para>
    			</parameter>
    			<parameter name="rule">
    				<para>Will cause the queue's defaultrule to be overridden by the rule specified.</para>
    			</parameter>
    
    			<parameter name="position">
    				<para>Attempt to enter the caller into the queue at the numerical position specified. <literal>1</literal>
    				would attempt to enter the caller at the head of the queue, and <literal>3</literal> would attempt to place
    				the caller third in the queue.</para>
    
    			</parameter>
    
    		</syntax>
    		<description>
    			<para>In addition to transferring the call, a call may be parked and then picked
    			up by another user.</para>
    			<para>This application will return to the dialplan if the queue does not exist, or
    			any of the join options cause the caller to not enter the queue.</para>
    
    			<para>This application does not automatically answer and should be preceeded
    			by an application such as Answer(), Progress(), or Ringing().</para>
    
    			<para>This application sets the following channel variable upon completion:</para>
    			<variablelist>
    				<variable name="QUEUESTATUS">
    					<para>The status of the call as a text string.</para>
    					<value name="TIMEOUT" />
    					<value name="FULL" />
    					<value name="JOINEMPTY" />
    					<value name="LEAVEEMPTY" />
    					<value name="JOINUNAVAIL" />
    					<value name="LEAVEUNAVAIL" />
    					<value name="CONTINUE" />
    				</variable>
    			</variablelist>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    
    			<ref type="function">QUEUE_EXISTS</ref>
    
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<application name="AddQueueMember" language="en_US">
    		<synopsis>
    			Dynamically adds queue members.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="interface" />
    			<parameter name="penalty" />
    			<parameter name="options" />
    			<parameter name="membername" />
    			<parameter name="stateinterface" />
    		</syntax>
    		<description>
    			<para>Dynamically adds interface to an existing queue. If the interface is
    			already in the queue it will return an error.</para>
    			<para>This application sets the following channel variable upon completion:</para>
    			<variablelist>
    				<variable name="AQMSTATUS">
    					<para>The status of the attempt to add a queue member as a text string.</para>
    					<value name="ADDED" />
    					<value name="MEMBERALREADY" />
    					<value name="NOSUCHQUEUE" />
    				</variable>
    			</variablelist>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<application name="RemoveQueueMember" language="en_US">
    		<synopsis>
    			Dynamically removes queue members.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="interface" />
    		</syntax>
    		<description>
    			<para>If the interface is <emphasis>NOT</emphasis> in the queue it will return an error.</para>
    			<para>This application sets the following channel variable upon completion:</para>
    			<variablelist>
    				<variable name="RQMSTATUS">
    					<value name="REMOVED" />
    					<value name="NOTINQUEUE" />
    					<value name="NOSUCHQUEUE" />
    
    					<value name="NOTDYNAMIC" />
    
    				</variable>
    			</variablelist>
    			<para>Example: RemoveQueueMember(techsupport,SIP/3000)</para>
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    
    			<ref type="application">QueueLog</ref>
    
    			<ref type="application">AddQueueMember</ref>
    
    			<ref type="application">RemoveQueueMember</ref>
    
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<application name="PauseQueueMember" language="en_US">
    		<synopsis>
    			Pauses a queue member.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" />
    			<parameter name="interface" required="true" />
    			<parameter name="options" />
    			<parameter name="reason">
    				<para>Is used to add extra information to the appropriate queue_log entries and manager events.</para>
    			</parameter>
    		</syntax>
    		<description>
    			<para>Pauses (blocks calls for) a queue member. The given interface will be paused in the given queue.
    			This prevents any calls from being sent from the queue to the interface until it is
    			unpaused with UnpauseQueueMember or the manager interface.  If no queuename is given,
    			the interface is paused in every queue it is a member of. The application will fail if the
    			interface is not found.</para>
    			<para>This application sets the following channel variable upon completion:</para>
    			<variablelist>
    				<variable name="PQMSTATUS">
    					<para>The status of the attempt to pause a queue member as a text string.</para>
    					<value name="PAUSED" />
    					<value name="NOTFOUND" />
    				</variable>
    			</variablelist>
    			<para>Example: PauseQueueMember(,SIP/3000)</para>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    
    			<ref type="application">UnpauseQueueMember</ref>
    
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<application name="UnpauseQueueMember" language="en_US">
    		<synopsis>
    
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" />
    			<parameter name="interface" required="true" />
    			<parameter name="options" />
    			<parameter name="reason">
    				<para>Is used to add extra information to the appropriate queue_log entries and manager events.</para>
    			</parameter>
    		</syntax>
    		<description>
    			<para>Unpauses (resumes calls to) a queue member. This is the counterpart to <literal>PauseQueueMember()</literal>
    			and operates exactly the same way, except it unpauses instead of pausing the given interface.</para>
    			<para>This application sets the following channel variable upon completion:</para>
    			<variablelist>
    				<variable name="UPQMSTATUS">
    					<para>The status of the attempt to unpause a queue member as a text string.</para>
    					<value name="UNPAUSED" />
    					<value name="NOTFOUND" />
    				</variable>
    			</variablelist>
    			<para>Example: UnpauseQueueMember(,SIP/3000)</para>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    
    			<ref type="application">PauseQueueMember</ref>
    
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<application name="QueueLog" language="en_US">
    		<synopsis>
    			Writes to the queue_log file.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="uniqueid" required="true" />
    			<parameter name="agent" required="true" />
    			<parameter name="event" required="true" />
    			<parameter name="additionalinfo" />
    		</syntax>
    		<description>
    			<para>Allows you to write your own events into the queue log.</para>
    			<para>Example: QueueLog(101,${UNIQUEID},${AGENT},WENTONBREAK,600)</para>
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</application>
    	<function name="QUEUE_VARIABLES" language="en_US">
    		<synopsis>
    			Return Queue information in variables.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true">
    				<enumlist>
    					<enum name="QUEUEMAX">
    						<para>Maxmimum number of calls allowed.</para>
    					</enum>
    					<enum name="QUEUESTRATEGY">
    						<para>The strategy of the queue.</para>
    					</enum>
    					<enum name="QUEUECALLS">
    						<para>Number of calls currently in the queue.</para>
    					</enum>
    					<enum name="QUEUEHOLDTIME">
    						<para>Current average hold time.</para>
    					</enum>
    					<enum name="QUEUECOMPLETED">
    						<para>Number of completed calls for the queue.</para>
    					</enum>
    					<enum name="QUEUEABANDONED">
    						<para>Number of abandoned calls.</para>
    					</enum>
    					<enum name="QUEUESRVLEVEL">
    						<para>Queue service level.</para>
    					</enum>
    					<enum name="QUEUESRVLEVELPERF">
    						<para>Current service level performance.</para>
    					</enum>
    				</enumlist>
    			</parameter>
    		</syntax>
    		<description>
    			<para>Makes the following queue variables available.</para>
    			<para>Returns <literal>0</literal> if queue is found and setqueuevar is defined, <literal>-1</literal> otherwise.</para>
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    		</see-also>
    
    	</function>
    	<function name="QUEUE_MEMBER" language="en_US">
    		<synopsis>
    			Count number of members answering a queue.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="option" required="true">
    				<enumlist>
    					<enum name="logged">
    						<para>Returns the number of logged-in members for the specified queue.</para>
    					</enum>
    					<enum name="free">
    
    						<para>Returns the number of logged-in members for the specified queue that either can take calls or are currently wrapping up after a previous call.</para>
    					</enum>
    					<enum name="ready">
    						<para>Returns the number of logged-in members for the specified queue that are immediately available to answer a call.</para>
    
    					</enum>
    					<enum name="count">
    						<para>Returns the total number of members for the specified queue.</para>
    					</enum>
    
    Gregory Nietsky's avatar
     
    Gregory Nietsky committed
    					<enum name="penalty">
    						<para>Gets or sets queue member penalty.</para>
    					</enum>
    					<enum name="paused">
    						<para>Gets or sets queue member paused status.</para>
    					</enum>
    
    					<enum name="ringinuse">
    						<para>Gets or sets queue member ringinuse.</para>
    
    Gregory Nietsky's avatar
     
    Gregory Nietsky committed
    					</enum>
    
    				</enumlist>
    			</parameter>
    
    Gregory Nietsky's avatar
     
    Gregory Nietsky committed
    			<parameter name="interface" required="false" />
    
    		</syntax>
    		<description>
    
    Gregory Nietsky's avatar
     
    Gregory Nietsky committed
    			<para>Allows access to queue counts [R] and member information [R/W].</para>
    			<para>
    				<replaceable>queuename</replaceable> is required for all operations
    				<replaceable>interface</replaceable> is required for all member operations.
    			</para>
    
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    		</see-also>
    
    	</function>
    	<function name="QUEUE_MEMBER_COUNT" language="en_US">
    		<synopsis>
    			Count number of members answering a queue.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    		</syntax>
    		<description>
    			<para>Returns the number of members currently associated with the specified <replaceable>queuename</replaceable>.</para>
    			<warning><para>This function has been deprecated in favor of the <literal>QUEUE_MEMBER()</literal> function</para></warning>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	<function name="QUEUE_EXISTS" language="en_US">
    		<synopsis>
    			Check if a named queue exists on this server
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" />
    		</syntax>
    		<description>
    			<para>Returns 1 if the specified queue exists, 0 if it does not</para>
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    		</see-also>
    
    	<function name="QUEUE_WAITING_COUNT" language="en_US">
    		<synopsis>
    			Count number of calls currently waiting in a queue.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" />
    		</syntax>
    		<description>
    			<para>Returns the number of callers currently waiting in the specified <replaceable>queuename</replaceable>.</para>
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    		</see-also>
    
    	</function>
    	<function name="QUEUE_MEMBER_LIST" language="en_US">
    		<synopsis>
    			Returns a list of interfaces on a queue.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    		</syntax>
    		<description>
    			<para>Returns a comma-separated list of members associated with the specified <replaceable>queuename</replaceable>.</para>
    		</description>
    
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    
    	</function>
    	<function name="QUEUE_MEMBER_PENALTY" language="en_US">
    		<synopsis>
    			Gets or sets queue members penalty.
    		</synopsis>
    		<syntax>
    			<parameter name="queuename" required="true" />
    			<parameter name="interface" required="true" />
    		</syntax>
    		<description>
    			<para>Gets or sets queue members penalty.</para>
    
    Gregory Nietsky's avatar
     
    Gregory Nietsky committed
    			<warning><para>This function has been deprecated in favor of the <literal>QUEUE_MEMBER()</literal> function</para></warning>
    
    		</description>
    
    		<see-also>
    			<ref type="application">Queue</ref>
    			<ref type="application">QueueLog</ref>
    			<ref type="application">AddQueueMember</ref>
    			<ref type="application">RemoveQueueMember</ref>
    			<ref type="application">PauseQueueMember</ref>
    			<ref type="application">UnpauseQueueMember</ref>
    			<ref type="function">QUEUE_VARIABLES</ref>
    			<ref type="function">QUEUE_MEMBER</ref>
    			<ref type="function">QUEUE_MEMBER_COUNT</ref>
    			<ref type="function">QUEUE_EXISTS</ref>
    			<ref type="function">QUEUE_WAITING_COUNT</ref>
    			<ref type="function">QUEUE_MEMBER_LIST</ref>
    			<ref type="function">QUEUE_MEMBER_PENALTY</ref>
    		</see-also>
    
    	<manager name="Queues" language="en_US">
    		<synopsis>
    			Queues.
    		</synopsis>
    		<syntax>
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueStatus" language="en_US">
    		<synopsis>
    			Show queue status.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" />
    			<parameter name="Member" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueSummary" language="en_US">
    		<synopsis>
    			Show queue summary.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueAdd" language="en_US">
    		<synopsis>
    			Add interface to queue.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" required="true" />
    			<parameter name="Interface" required="true" />
    			<parameter name="Penalty" />
    			<parameter name="Paused" />
    			<parameter name="MemberName" />
    			<parameter name="StateInterface" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueRemove" language="en_US">
    		<synopsis>
    			Remove interface from queue.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" required="true" />
    			<parameter name="Interface" required="true" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueuePause" language="en_US">
    		<synopsis>
    			Makes a queue member temporarily unavailable.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Interface" required="true" />
    			<parameter name="Paused" required="true" />
    			<parameter name="Queue" />
    			<parameter name="Reason" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueLog" language="en_US">
    		<synopsis>
    			Adds custom entry in queue_log.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" required="true" />
    			<parameter name="Event" required="true" />
    			<parameter name="Uniqueid" />
    			<parameter name="Interface" />
    			<parameter name="Message" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueuePenalty" language="en_US">
    		<synopsis>
    			Set the penalty for a queue member.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Interface" required="true" />
    			<parameter name="Penalty" required="true" />
    			<parameter name="Queue" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    
    	<manager name="QueueMemberRingInUse" language="en_US">
    		<synopsis>
    			Set the ringinuse value for a queue member.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Interface" required="true" />
    			<parameter name="RingInUse" required="true" />
    			<parameter name="Queue" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    
    	<manager name="QueueRule" language="en_US">
    		<synopsis>
    			Queue Rules.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Rule" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueReload" language="en_US">
    		<synopsis>
    			Reload a queue, queues, or any sub-section of a queue or queues.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" />
    			<parameter name="Members">
    				<enumlist>
    					<enum name="yes" />
    					<enum name="no" />
    				</enumlist>
    			</parameter>
    			<parameter name="Rules">
    				<enumlist>
    					<enum name="yes" />
    					<enum name="no" />
    				</enumlist>
    			</parameter>
    			<parameter name="Parameters">
    				<enumlist>
    					<enum name="yes" />
    					<enum name="no" />
    				</enumlist>
    			</parameter>
    		</syntax>
    		<description>
    		</description>
    	</manager>
    	<manager name="QueueReset" language="en_US">
    		<synopsis>
    			Reset queue statistics.
    		</synopsis>
    		<syntax>
    			<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
    			<parameter name="Queue" />
    		</syntax>
    		<description>
    		</description>
    	</manager>
    
    
    	<managerEvent language="en_US" name="QueueMemberStatus">
    		<managerEventInstance class="EVENT_FLAG_AGENT">
    			<synopsis>Raised when a Queue member's status has changed.</synopsis>
    			<syntax>
    				<parameter name="Queue">
    					<para>The name of the queue.</para>
    				</parameter>
    				<parameter name="MemberName">
    					<para>The name of the queue member.</para>
    				</parameter>
    				<parameter name="Interface">
    					<para>The queue member's channel technology or location.</para>
    				</parameter>
    				<parameter name="StateInterface">
    					<para>Channel technology or location from which to read device state changes.</para>
    				</parameter>
    				<parameter name="Membership">
    					<enumlist>
    						<enum name="dynamic"/>
    						<enum name="realtime"/>
    						<enum name="static"/>
    					</enumlist>
    				</parameter>
    				<parameter name="Penalty">
    					<para>The penalty associated with the queue member.</para>
    				</parameter>
    				<parameter name="CallsTaken">
    					<para>The number of calls this queue member has serviced.</para>
    				</parameter>
    				<parameter name="LastCall">
    					<para>The time this member last took a call, expressed in seconds since 00:00, Jan 1, 1970 UTC.</para>
    				</parameter>
    				<parameter name="Status">
    					<para>The numeric device state status of the queue member.</para>
    					<enumlist>
    						<enum name="0"><para>AST_DEVICE_UNKNOWN</para></enum>
    						<enum name="1"><para>AST_DEVICE_NOT_INUSE</para></enum>
    						<enum name="2"><para>AST_DEVICE_INUSE</para></enum>
    						<enum name="3"><para>AST_DEVICE_BUSY</para></enum>
    						<enum name="4"><para>AST_DEVICE_INVALID</para></enum>
    						<enum name="5"><para>AST_DEVICE_UNAVAILABLE</para></enum>
    						<enum name="6"><para>AST_DEVICE_RINGING</para></enum>
    						<enum name="7"><para>AST_DEVICE_RINGINUSE</para></enum>
    						<enum name="8"><para>AST_DEVICE_ONHOLD</para></enum>
    					</enumlist>
    				</parameter>
    				<parameter name="Paused">
    					<enumlist>
    						<enum name="0"/>
    						<enum name="1"/>
    					</enumlist>
    				</parameter>
    				<parameter name="Ringinuse">
    					<enumlist>
    						<enum name="0"/>
    						<enum name="1"/>
    					</enumlist>
    				</parameter>
    			</syntax>
    		</managerEventInstance>
    	</managerEvent>
    	<managerEvent language="en_US" name="QueueMemberAdded">
    		<managerEventInstance class="EVENT_FLAG_AGENT">
    			<synopsis>Raised when a member is added to the queue.</synopsis>
    			<syntax>
    				<xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter)" />
    			</syntax>
    			<see-also>
    				<ref type="managerEvent">QueueMemberRemoved</ref>
    				<ref type="application">AddQueueMember</ref>
    			</see-also>
    		</managerEventInstance>
    	</managerEvent>
    	<managerEvent language="en_US" name="QueueMemberRemoved">
    		<managerEventInstance class="EVENT_FLAG_AGENT">
    			<synopsis>Raised when a member is removed from the queue.</synopsis>
    			<syntax>
    				<xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter)" />
    			</syntax>
    			<see-also>
    				<ref type="managerEvent">QueueMemberAdded</ref>
    				<ref type="application">RemoveQueueMember</ref>
    			</see-also>
    		</managerEventInstance>
    	</managerEvent>
    	<managerEvent language="en_US" name="QueueMemberPaused">
    		<managerEventInstance class="EVENT_FLAG_AGENT">
    			<synopsis>Raised when a member is paused/unpaused in the queue.</synopsis>
    			<syntax>
    				<xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter)" />
    				<parameter name="Reason">
    					<para>The reason a member was paused.</para>
    				</parameter>
    			</syntax>
    			<see-also>
    				<ref type="application">PauseQueueMember</ref>
    				<ref type="application">UnPauseQueueMember</ref>
    			</see-also>
    		</managerEventInstance>
    	</managerEvent>
    	<managerEvent language="en_US" name="QueueMemberPenalty">
    		<managerEventInstance class="EVENT_FLAG_AGENT">
    			<synopsis>Raised when a member's penalty is changed.</synopsis>
    			<syntax>
    				<xi:include xpointer="xpointer(/docs/managerEvent[@name='QueueMemberStatus']/managerEventInstance/syntax/parameter)" />