[svn-commits] mmichelson: branch 1.6.1 r138698 - in /branches/1.6.1: ./ apps/ configs/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 18 15:24:30 CDT 2008


Author: mmichelson
Date: Mon Aug 18 15:24:29 2008
New Revision: 138698

URL: http://svn.digium.com/view/asterisk?view=rev&rev=138698
Log:
Merged revisions 138694 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r138694 | mmichelson | 2008-08-18 15:23:11 -0500 (Mon, 18 Aug 2008) | 10 lines

Change the queue timeout priority logic into less ugly
and confusing code pieces. Clarify the logic within
queues.conf.sample.

(closes issue #12690)
Reported by: atis
Patches:
      queue_timeoutpriority.patch uploaded by atis (license 242)


........

Modified:
    branches/1.6.1/   (props changed)
    branches/1.6.1/apps/app_queue.c
    branches/1.6.1/configs/queues.conf.sample

Propchange: branches/1.6.1/
------------------------------------------------------------------------------
--- trunk-merged (original)
+++ trunk-merged Mon Aug 18 15:24:29 2008
@@ -1,1 +1,1 @@
-/trunk:1-137647,137680,137732,137780,137812,137848,137933,137987,138024,138028,138086,138124,138148,138155,138207,138260,138311,138361,138409,138412,138442,138473,138476,138479,138482,138518,138631,138687
+/trunk:1-137647,137680,137732,137780,137812,137848,137933,137987,138024,138028,138086,138124,138148,138155,138207,138260,138311,138361,138409,138412,138442,138473,138476,138479,138482,138518,138631,138687,138694

Modified: branches/1.6.1/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/apps/app_queue.c?view=diff&rev=138698&r1=138697&r2=138698
==============================================================================
--- branches/1.6.1/apps/app_queue.c (original)
+++ branches/1.6.1/apps/app_queue.c Mon Aug 18 15:24:29 2008
@@ -2313,6 +2313,14 @@
 			/* Ring just the best channel */
 			ast_debug(1, "Trying '%s' with metric %d\n", best->interface, best->metric);
 			ret = ring_entry(qe, best, busies);
+		}
+		
+		/* If we have timed out, break out */
+		if (qe->expire && (time(NULL) >= qe->expire)) {
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Queue timed out while ringing members.\n");
+			ret = 0;
+			break;
 		}
 	}
 
@@ -3407,10 +3415,22 @@
 		}
 	}
 
-	if (qe->expire && (!qe->parent->timeout || (qe->parent->timeoutpriority == TIMEOUT_PRIORITY_APP && (qe->expire - now) <= qe->parent->timeout)))
-		to = (qe->expire - now) * 1000;
-	else
-		to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+	if (qe->parent->timeoutpriority == TIMEOUT_PRIORITY_APP) {
+		/* Application arguments have higher timeout priority (behaviour for <=1.6) */
+		if (qe->expire && (!qe->parent->timeout || (qe->expire - now) <= qe->parent->timeout))
+			to = (qe->expire - now) * 1000;
+		else
+			to = (qe->parent->timeout) ? qe->parent->timeout * 1000 : -1;
+	} else {
+		/* Config timeout is higher priority thatn application timeout */
+		if (qe->expire && qe->expire<=now) {
+			to = 0;
+		} else if (qe->parent->timeout) {
+			to = qe->parent->timeout * 1000;
+		} else {
+			to = -1;
+		}
+	}
 	orig = to;
 	++qe->pending;
 	ao2_unlock(qe->parent);

Modified: branches/1.6.1/configs/queues.conf.sample
URL: http://svn.digium.com/view/asterisk/branches/1.6.1/configs/queues.conf.sample?view=diff&rev=138698&r1=138697&r2=138698
==============================================================================
--- branches/1.6.1/configs/queues.conf.sample (original)
+++ branches/1.6.1/configs/queues.conf.sample Mon Aug 18 15:24:29 2008
@@ -148,11 +148,19 @@
 ; Queue application is more important. In the scenario above, timeoutpriority=app
 ; would result in the second member's phone ringing for 1 second.
 ;
-; There are a few exceptions to the priority rules. For instance, if the configuration
-; file timeout is set to 0, but the application argument timeout is non-zero, then the
-; timeoutpriority is ignored and the application argument is used as the timeout. Furthermore,
-; if no application argument timeout is specified, then the timeoutpriority option is
-; ignored and the configuration file timeout is always used when calling queue members.
+; There are a few exceptions to the priority rules. For instance, if timeoutpriority=appp
+; and the configuration file timeout is set to 0, but the application argument timeout is
+; non-zero, then the timeoutpriority is ignored and the application argument is used as
+; the timeout. Furthermore, if no application argument timeout is specified, then the
+; timeoutpriority option is ignored and the configuration file timeout is always used 
+; when calling queue members.
+;
+; In timeoutpriority=conf mode however timeout specified in config file will take higher
+; priority than timeout in application arguments, so if config file has timeout 0, each
+; queue member will be called indefineately and application timeout will be checked only
+; after this call attempt. This is useful for having queue members with custom timeouts
+; specified within Dial application of Local channel, and allows handling NO ANSWER which
+; would otherwise be interrupted by queue destroying child channel on timeout.
 ;
 ; The default value for timeoutpriority is "app" since this was how previous versions of
 ; Asterisk behaved.




More information about the svn-commits mailing list