mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 22:58:21 +00:00
QUEUE_MEMBER(..., ready) counts only ready agents, not free agents wrapping up
The QUEUE_MEMBER dialplan function can return total members, logged-in members and "free" members count. A member is counted as "free" immediately after his call ends, even though its wrap-up time, if specified in queues.conf, has not yet expired, and the queue will not actually route a call to it. This Patch introduces a new "ready" option that only counts free agents no longer in the wrap up time period. (closes issue #16240) Reported by: kkm Patches: appqueue-memberfun-readyoption-trunk.diff uploaded by kkm (license 888) Tested by: kkm, dvossel git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@236308 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -437,7 +437,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
|
|||||||
<para>Returns the number of logged-in members for the specified queue.</para>
|
<para>Returns the number of logged-in members for the specified queue.</para>
|
||||||
</enum>
|
</enum>
|
||||||
<enum name="free">
|
<enum name="free">
|
||||||
<para>Returns the number of logged-in members for the specified queue available to take a call.</para>
|
<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>
|
||||||
<enum name="count">
|
<enum name="count">
|
||||||
<para>Returns the total number of members for the specified queue.</para>
|
<para>Returns the total number of members for the specified queue.</para>
|
||||||
@@ -5793,8 +5796,8 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Get number either busy / free or total members of a specific queue
|
* \brief Get number either busy / free / ready or total members of a specific queue
|
||||||
* \retval number of members (busy / free / total)
|
* \retval number of members (busy / free / ready / total)
|
||||||
* \retval -1 on error
|
* \retval -1 on error
|
||||||
*/
|
*/
|
||||||
static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
|
||||||
@@ -5836,6 +5839,19 @@ static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *d
|
|||||||
ao2_ref(m, -1);
|
ao2_ref(m, -1);
|
||||||
}
|
}
|
||||||
ao2_iterator_destroy(&mem_iter);
|
ao2_iterator_destroy(&mem_iter);
|
||||||
|
} else if (!strcasecmp(option, "ready")) {
|
||||||
|
time_t now;
|
||||||
|
time(&now);
|
||||||
|
mem_iter = ao2_iterator_init(q->members, 0);
|
||||||
|
while ((m = ao2_iterator_next(&mem_iter))) {
|
||||||
|
/* Count the agents who are logged in, not paused and not wrapping up */
|
||||||
|
if ((m->status == AST_DEVICE_NOT_INUSE) && (!m->paused) &&
|
||||||
|
!(m->lastcall && q->wrapuptime && ((now - q->wrapuptime) < m->lastcall))) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
ao2_ref(m, -1);
|
||||||
|
}
|
||||||
|
ao2_iterator_destroy(&mem_iter);
|
||||||
} else /* must be "count" */
|
} else /* must be "count" */
|
||||||
count = q->membercount;
|
count = q->membercount;
|
||||||
ao2_unlock(q);
|
ao2_unlock(q);
|
||||||
|
Reference in New Issue
Block a user