[asterisk-commits] russell: branch 1.4 r89839 - /branches/1.4/main/pbx.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Nov 27 17:16:00 CST 2007
Author: russell
Date: Tue Nov 27 17:16:00 2007
New Revision: 89839
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89839
Log:
Don't start/stop autoservice in pbx_extension_helper() unless a channel exists
Modified:
branches/1.4/main/pbx.c
Modified: branches/1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/pbx.c?view=diff&rev=89839&r1=89838&r2=89839
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Tue Nov 27 17:16:00 2007
@@ -1792,26 +1792,30 @@
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
- ast_autoservice_start(c);
+ if (c)
+ ast_autoservice_start(c);
ast_mutex_lock(&conlock);
e = pbx_find_extension(c, con, &q, context, exten, priority, label, callerid, action);
if (e) {
if (matching_action) {
ast_mutex_unlock(&conlock);
- 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_mutex_unlock(&conlock);
- ast_autoservice_stop(c);
+ if (c)
+ ast_autoservice_stop(c);
return res; /* the priority we were looking for */
} else { /* spawn */
app = pbx_findapp(e->app);
ast_mutex_unlock(&conlock);
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)
@@ -1847,20 +1851,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_mutex_unlock(&conlock);
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 */
@@ -1887,7 +1894,8 @@
ast_log(LOG_DEBUG, "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