[asterisk-commits] mjordan: branch 11 r396948 - /branches/11/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 19 19:06:39 CDT 2013


Author: mjordan
Date: Mon Aug 19 19:06:37 2013
New Revision: 396948

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396948
Log:
Let Queue wrap up time influence member availability

Queue members who happen to be in multiple queues at the same time may not
have any wrap up time. This problem occurred due to a code change in Asterisk
11.3.0 that unified device state tracking of Queue members in multiple
Queues (which fixed some other problems, but unfortunately caused this one).

This patch fixes the behavior by having the is_member_available function
check the queue's wrap up time and the time of the member's last call, such
that for a particular queue, the member won't be considered available if their
last call is within the wrap up time.

(closes issue ASTERISK-22189)
Reported by: Tony Lewis
Tested by: Tony Lewis


Modified:
    branches/11/apps/app_queue.c

Modified: branches/11/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/apps/app_queue.c?view=diff&rev=396948&r1=396947&r2=396948
==============================================================================
--- branches/11/apps/app_queue.c (original)
+++ branches/11/apps/app_queue.c Mon Aug 19 19:06:37 2013
@@ -1709,7 +1709,7 @@
  * \retval 1 if the member is available
  * \retval 0 if the member is not available
  */
-static int is_member_available(struct member *mem)
+static int is_member_available(struct call_queue *q, struct member *mem)
 {
 	int available = 0;
 
@@ -1734,6 +1734,10 @@
 			break;
 	}
 
+	/* Let wrapuptimes override device state availability */
+	if (mem->lastcall && q->wrapuptime && (time(NULL) - q->wrapuptime < mem->lastcall)) {
+		available = 0;
+	}
 	return available;
 }
 
@@ -1774,7 +1778,7 @@
 
 			/* check every member until we find one NOT_INUSE */
 			if (!avail) {
-				avail = is_member_available(m);
+				avail = is_member_available(q, m);
 			}
 			if (avail && found_member) {
 				/* early exit as we've found an available member and the member of interest */
@@ -3384,7 +3388,7 @@
 	mem_iter = ao2_iterator_init(q->members, 0);
 	while ((mem = ao2_iterator_next(&mem_iter))) {
 
-		avl += is_member_available(mem);
+		avl += is_member_available(q, mem);
 		ao2_ref(mem, -1);
 
 		/* If autofill is not enabled or if the queue's strategy is ringall, then
@@ -6169,7 +6173,7 @@
 				new_member->penalty, new_member->calls, (int) new_member->lastcall,
 				new_member->status, new_member->paused);
 
-			if (is_member_available(new_member)) {
+			if (is_member_available(q, new_member)) {
 				ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
 			}
 
@@ -6235,7 +6239,7 @@
 					dump_queue_members(q);
 				}
 
-				if (is_member_available(mem)) {
+				if (is_member_available(q, mem)) {
 					ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);
 				} else if (!num_available_members(q)) {
 					ast_devstate_changed(AST_DEVICE_INUSE, AST_DEVSTATE_CACHABLE, "Queue:%s_avail", q->name);




More information about the asterisk-commits mailing list