[asterisk-commits] oej: branch oej/moremanager r180680 - /team/oej/moremanager/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Mar 8 16:04:39 CDT 2009


Author: oej
Date: Sun Mar  8 16:04:35 2009
New Revision: 180680

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=180680
Log:
Add manager event when we reach a configured limit and deny a call

Modified:
    team/oej/moremanager/main/pbx.c

Modified: team/oej/moremanager/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/oej/moremanager/main/pbx.c?view=diff&rev=180680&r1=180679&r2=180680
==============================================================================
--- team/oej/moremanager/main/pbx.c (original)
+++ team/oej/moremanager/main/pbx.c Sun Mar  8 16:04:35 2009
@@ -2581,7 +2581,7 @@
 static int increase_call_count(const struct ast_channel *c)
 {
 	int failed = 0;
-	double curloadavg;
+	double curloadavg = 0;
 	ast_mutex_lock(&maxcalllock);
 	if (option_maxcalls) {
 		if (countcalls >= option_maxcalls) {
@@ -2596,8 +2596,21 @@
 			failed = -1;
 		}
 	}
-	if (!failed)
+	if (!failed) {
 		countcalls++;
+	} else {
+		/* Tell manager that we've reached the limit */
+		manager_event(EVENT_FLAG_SYSTEM, "ConfigLimitReached",
+			"CoreMaxCalls: %d\r\n"
+			"CoreCurrentCalls: %d\r\n"
+			"CoreMaxLoadAvg: %f\r\n"
+			"CoreCurrentLoadAvg: %f\r\n"	
+			"\r\n", 
+			option_maxcalls, countcalls,
+			option_maxload, curloadavg);
+ 	}
+ 	ast_mutex_unlock(&maxcalllock);
+ 
 	ast_mutex_unlock(&maxcalllock);
 
 	return failed;




More information about the asterisk-commits mailing list