diff options
author | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-27 23:17:36 +0000 |
---|---|---|
committer | russell <russell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-27 23:17:36 +0000 |
commit | a84d13a66f8dc2ec205990bf67f9ab4734a10d54 (patch) | |
tree | 9cfa5fe683d6200a43640d187ce458bb42a761d6 /main/pbx.c | |
parent | c6423f296f417302ba7acbf4cb6aeac30058f3b7 (diff) |
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
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89840 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r-- | main/pbx.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/main/pbx.c b/main/pbx.c index b665e2c01..857b7e218 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -2609,7 +2609,8 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, 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 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, *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 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, 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 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, "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 @@ static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, ast_debug(1, "Shouldn't happen!\n"); } - ast_autoservice_stop(c); + if (c) + ast_autoservice_stop(c); return (matching_action) ? 0 : -1; } |