aboutsummaryrefslogtreecommitdiffstats
path: root/main/pbx.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 20:54:18 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-02-11 20:54:18 +0000
commitc8dda30fa05cb3f3fa319191565e38e665b80753 (patch)
treecb358f5fd2d1d9dc200c81380054792d4e16a0a3 /main/pbx.c
parent4d45fa634261591d9bbf0d080685727b2aae4eb8 (diff)
Restore a behavior that was recently changed, when we fixed issue #13962 and
issue #13363 (related to issue #6176). When a hangup occurs during a Macro execution in earlier 1.4, the h extension would execute within the Macro context, whereas it was always supposed to execute only within the main context (where Macro was called). So this fix checks for an "h" extension in the deepest macro context where a hangup occurred; if it exists, that "h" extension executes, otherwise the main context "h" is executed. (closes issue #14122) Reported by: wetwired Patches: 20090210__bug14122.diff.txt uploaded by Corydon76 (license 14) Tested by: andrew git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@174885 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 44a769a6a..187447588 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -2365,6 +2365,7 @@ static int __ast_pbx_run(struct ast_channel *c)
int res = 0;
int autoloopflag;
int error = 0; /* set an error conditions */
+ const char *emc;
/* A little initial setup here */
if (c->pbx) {
@@ -2542,7 +2543,15 @@ static int __ast_pbx_run(struct ast_channel *c)
ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", c->name);
if (res != AST_PBX_KEEPALIVE)
ast_softhangup(c, c->hangupcause ? c->hangupcause : AST_CAUSE_NORMAL_CLEARING);
- if ((res != AST_PBX_KEEPALIVE) && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) && ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num)) {
+ ast_channel_lock(c);
+ if ((emc = pbx_builtin_getvar_helper(c, "EXIT_MACRO_CONTEXT"))) {
+ emc = ast_strdupa(emc);
+ }
+ ast_channel_unlock(c);
+ if ((res != AST_PBX_KEEPALIVE) && !ast_test_flag(c, AST_FLAG_BRIDGE_HANGUP_RUN) &&
+ ((emc && ast_exists_extension(c, emc, "h", 1, c->cid.cid_num)) ||
+ (ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num) && (emc = c->context)))) {
+ ast_copy_string(c->context, emc, sizeof(c->context));
set_ext_pri(c, "h", 1);
if (c->cdr && ast_opt_end_cdr_before_h_exten) {
ast_cdr_end(c->cdr);