[asterisk-commits] mmichelson: branch 1.4 r95890 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 2 11:51:22 CST 2008


Author: mmichelson
Date: Wed Jan  2 11:51:22 2008
New Revision: 95890

URL: http://svn.digium.com/view/asterisk?view=rev&rev=95890
Log:
A change to improve the accuracy of queue logging in the case where a member does not
answer during the specified timeout period. Prior to this change, there was a small chance
that the member name recorded in this case would be blank. Also prior to this change, if using
the ringall strategy, if no one answered the call during the specified timeout, the member name
listed in the queue log would randomly be one of the members that was rung.

(closes issue #11498, reported and tested by hloubser, patched by me)


Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=95890&r1=95889&r2=95890
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Wed Jan  2 11:51:22 2008
@@ -283,10 +283,18 @@
 
 /*! \brief We define a custom "local user" structure because we
    use it not only for keeping track of what is in use but
-   also for keeping track of who we're dialing. */
+   also for keeping track of who we're dialing.
+
+   There are two "links" defined in this structure, q_next and call_next.
+   q_next links ALL defined callattempt structures into a linked list. call_next is
+   a link which allows for a subset of the callattempts to be traversed. This subset
+   is used in wait_for_answer so that irrelevant callattempts are not traversed. This
+   also is helpful so that queue logs are always accurate in the case where a call to 
+   a member times out, especially if using the ringall strategy. */
 
 struct callattempt {
 	struct callattempt *q_next;
+	struct callattempt *call_next;
 	struct ast_channel *chan;
 	char interface[256];
 	int stillgoing;
@@ -2040,7 +2048,7 @@
 static struct callattempt *wait_for_answer(struct queue_ent *qe, struct callattempt *outgoing, int *to, char *digit, int prebusies, int caller_disconnect, int forwardsallowed)
 {
 	char *queue = qe->parent->name;
-	struct callattempt *o;
+	struct callattempt *o, *start = NULL, *prev = NULL;
 	int status;
 	int numbusies = prebusies;
 	int numnochan = 0;
@@ -2061,14 +2069,21 @@
 		int numlines, retry, pos = 1;
 		struct ast_channel *watchers[AST_MAX_WATCHERS];
 		watchers[0] = in;
+		start = NULL;
 
 		for (retry = 0; retry < 2; retry++) {
 			numlines = 0;
 			for (o = outgoing; o; o = o->q_next) { /* Keep track of important channels */
 				if (o->stillgoing) {	/* Keep track of important channels */
 					stillgoing = 1;
-					if (o->chan)
+					if (o->chan) {
 						watchers[pos++] = o->chan;
+						if (!start)
+							start = o;
+						else
+							prev->call_next = o;
+						prev = o;
+					}
 				}
 				numlines++;
 			}
@@ -2090,7 +2105,7 @@
 			return NULL;
 		}
 		winner = ast_waitfor_n(watchers, pos, to);
-		for (o = outgoing; o; o = o->q_next) {
+		for (o = start; o; o = o->call_next) {
 			if (o->stillgoing && (o->chan) &&  (o->chan->_state == AST_STATE_UP)) {
 				if (!peer) {
 					if (option_verbose > 2)
@@ -2260,8 +2275,10 @@
 			}
 			ast_frfree(f);
 		}
-		if (!*to)
-			rna(orig, qe, on, membername);
+		if (!*to) {
+			for (o = start; o; o = o->call_next)
+				rna(orig, qe, o->interface, o->member->membername);
+		}
 	}
 
 	return peer;




More information about the asterisk-commits mailing list