[asterisk-commits] russell: trunk r89840 - in /trunk: ./ main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 27 17:17:37 CST 2007


Author: russell
Date: Tue Nov 27 17:17:36 2007
New Revision: 89840

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89840
Log:
Merged revisions 89839 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r89839 | russell | 2007-11-27 17:16:00 -0600 (Tue, 27 Nov 2007) | 2 lines

Don't start/stop autoservice in pbx_extension_helper() unless a channel exists

........

Modified:
    trunk/   (props changed)
    trunk/main/pbx.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=89840&r1=89839&r2=89840
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Tue Nov 27 17:17:36 2007
@@ -2609,7 +2609,8 @@
 
 	int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
 
-	ast_autoservice_start(c);
+	if (c)
+		ast_autoservice_start(c);
 	
 	ast_rdlock_contexts();
 	if (found)
@@ -2621,12 +2622,14 @@
 			*found = 1;
 		if (matching_action) {
 			ast_unlock_contexts();
-			ast_autoservice_stop(c);
+			if (c)
+				ast_autoservice_stop(c);
 			return -1;	/* success, we found it */
 		} else if (action == E_FINDLABEL) { /* map the label to a priority */
 			res = e->priority;
 			ast_unlock_contexts();
-			ast_autoservice_stop(c);
+			if (c)
+				ast_autoservice_stop(c);
 			return res;	/* the priority we were looking for */
 		} else {	/* spawn */
 			if (!e->cached_app)
@@ -2635,7 +2638,8 @@
 			ast_unlock_contexts();
 			if (!app) {
 				ast_log(LOG_WARNING, "No application '%s' for extension (%s, %s, %d)\n", e->app, context, exten, priority);
-				ast_autoservice_stop(c);
+				if (c)
+					ast_autoservice_stop(c);
 				return -1;
 			}
 			if (c->context != context)
@@ -2671,20 +2675,23 @@
 					"AppData: %s\r\n"
 					"Uniqueid: %s\r\n",
 					c->name, c->context, c->exten, c->priority, app->name, passdata, c->uniqueid);
-			ast_autoservice_stop(c);
+			if (c)
+				ast_autoservice_stop(c);
 			return pbx_exec(c, app, passdata);	/* 0 on success, -1 on failure */
 		}
 	} else if (q.swo) {	/* not found here, but in another switch */
 		ast_unlock_contexts();
 		if (matching_action) {
-			ast_autoservice_stop(c);
+			if (c)
+				ast_autoservice_stop(c);
 			return -1;
 		} else {
 			if (!q.swo->exec) {
 				ast_log(LOG_WARNING, "No execution engine for switch %s\n", q.swo->name);
 				res = -1;
 			}
-			ast_autoservice_stop(c);
+			if (c)
+				ast_autoservice_stop(c);
 			return q.swo->exec(c, q.foundcontext ? q.foundcontext : context, exten, priority, callerid, q.data);
 		}
 	} else {	/* not found anywhere, see what happened */
@@ -2710,7 +2717,8 @@
 			ast_debug(1, "Shouldn't happen!\n");
 		}
 
-		ast_autoservice_stop(c);
+		if (c)
+			ast_autoservice_stop(c);
 
 		return (matching_action) ? 0 : -1;
 	}




More information about the asterisk-commits mailing list