aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-08 21:05:01 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-08 21:05:01 +0000
commita79fa306564592af1c42a255ba610ce54df24c6a (patch)
tree44c95235a5d6c2ef90ffd1cbd56cfd505f4bc6be /main
parentab06baf0e629a91c35e88109f5b1b5568490cf53 (diff)
Merged revisions 141806 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r141806 | russell | 2008-09-08 16:02:36 -0500 (Mon, 08 Sep 2008) | 7 lines When doing an async goto, detect if the channel is already in the middle of a masquerade. This can happen when chan_local is trying to optimize itself out. If this happens, fail the async goto instead of bursting into flames. (closes issue #13435) Reported by: geoff2010 ........ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@141807 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/pbx.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 3ed9536b5..c0968b84e 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6573,17 +6573,23 @@ int ast_async_goto(struct ast_channel *chan, const char *context, const char *ex
S_OR(context, chan->context), S_OR(exten, chan->exten), priority);
/* Masquerade into temp channel */
- ast_channel_masquerade(tmpchan, chan);
-
- /* Grab the locks and get going */
- ast_channel_lock(tmpchan);
- ast_do_masquerade(tmpchan);
- ast_channel_unlock(tmpchan);
- /* Start the PBX going on our stolen channel */
- if (ast_pbx_start(tmpchan)) {
- ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmpchan->name);
+ if (ast_channel_masquerade(tmpchan, chan)) {
+ /* Failed to set up the masquerade. It's probably chan_local
+ * in the middle of optimizing itself out. Sad. :( */
ast_hangup(tmpchan);
+ tmpchan = NULL;
res = -1;
+ } else {
+ /* Grab the locks and get going */
+ ast_channel_lock(tmpchan);
+ ast_do_masquerade(tmpchan);
+ ast_channel_unlock(tmpchan);
+ /* Start the PBX going on our stolen channel */
+ if (ast_pbx_start(tmpchan)) {
+ ast_log(LOG_WARNING, "Unable to start PBX on %s\n", tmpchan->name);
+ ast_hangup(tmpchan);
+ res = -1;
+ }
}
}
}