[asterisk-commits] mjordan: trunk r396010 - in /trunk: CHANGES apps/app_queue.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 1 14:11:50 CDT 2013
Author: mjordan
Date: Thu Aug 1 14:11:46 2013
New Revision: 396010
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396010
Log:
Add queue member paused hints
This patch adds the ability in Queue to raise a hint when a member's paused
state changes. The hint uses the form 'Queue:{queue_name}_pause_{member_name}',
where {queue_name} and {member_name} are the name of the queue and the name
of the member to subscribe to, respectively.
For example: exten => 8501,hint,Queue:sales_pause_mark.
Members will show as In Use when paused.
Note that the format of the queue pause hint was changed slightly from what
is on the issue to accomodate suggestion on the code review.
Review: https://reviewboard.asterisk.org/r/2254
(closes issue ASTERISK-20842)
Reported by: Philippe Lindheimer
patches:
qpause-10-378206.diff uploaded by Philippe Lindheimer (license 5519)
qpause-11-378206.diff uploaded by Philippe Lindheimer (license 5519)
qpause-trunk-378206.diff uploaded by Philippe Lindheimer (license 5519)
Modified:
trunk/CHANGES
trunk/apps/app_queue.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=396010&r1=396009&r2=396010
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Aug 1 14:11:46 2013
@@ -97,6 +97,12 @@
removed. As a result, the AMI events QueueMemberStatus, AgentCalled,
AgentConnect, AgentComplete, AgentDump, and AgentRingNoAnswer will always be
sent. The "Variable" fields will also no longer exist on the Agent* events.
+
+ * Queues now support a hint for member paused state. The hint uses the form
+ 'Queue:{queue_name}_pause_{member_name}', where {queue_name} and {member_name}
+ are the name of the queue and the name of the member to subscribe to,
+ respectively. For example: exten => 8501,hint,Queue:sales_pause_mark.
+ Members will show as In Use when paused.
ResetCDR
------------------
Modified: trunk/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_queue.c?view=diff&rev=396010&r1=396009&r2=396010
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Thu Aug 1 14:11:46 2013
@@ -2781,6 +2781,11 @@
}
}
+
+#define QUEUE_PAUSED_DEVSTATE AST_DEVICE_INUSE
+#define QUEUE_UNPAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
+#define QUEUE_UNKNOWN_PAUSED_DEVSTATE AST_DEVICE_NOT_INUSE
+
/*! \internal
* \brief If adding a single new member to a queue, use this function instead of ao2_linking.
* This adds round robin queue position data for a fresh member as well as links it.
@@ -2792,6 +2797,8 @@
ao2_lock(queue->members);
mem->queuepos = ao2_container_count(queue->members);
ao2_link(queue->members, mem);
+ ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", queue->name, mem->interface);
ao2_unlock(queue->members);
}
@@ -2804,6 +2811,7 @@
static void member_remove_from_queue(struct call_queue *queue, struct member *mem)
{
ao2_lock(queue->members);
+ ast_devstate_changed(QUEUE_UNKNOWN_PAUSED_DEVSTATE, AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", queue->name, mem->interface);
queue_member_follower_removal(queue, mem);
ao2_unlink(queue->members, mem);
ao2_unlock(queue->members);
@@ -2870,6 +2878,8 @@
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
if (paused_str) {
m->paused = paused;
+ ast_devstate_changed(m->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, m->interface);
}
if (strcasecmp(state_interface, m->state_interface)) {
ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
@@ -6286,7 +6296,8 @@
}
mem->paused = paused;
-
+ ast_devstate_changed(mem->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, mem->interface);
found++;
/* Before we do the PAUSE/UNPAUSE log, if this was a PAUSEALL/UNPAUSEALL, log that here, but only on the first found entry. */
@@ -7425,8 +7436,10 @@
if (m->realtime) {
update_realtime_member_field(m, q->name, args.option, rtvalue);
}
-
m->paused = (memvalue <= 0) ? 0 : 1;
+ ast_devstate_changed(m->paused ? QUEUE_PAUSED_DEVSTATE : QUEUE_UNPAUSED_DEVSTATE,
+ AST_DEVSTATE_CACHABLE, "Queue:%s_pause_%s", q->name, args.interface);
+
} else if ((!strcasecmp(args.option, "ignorebusy")) || (!strcasecmp(args.option, "ringinuse"))) {
if (m->realtime) {
update_realtime_member_field(m, q->name, args.option, rtvalue);
More information about the asterisk-commits
mailing list