aboutsummaryrefslogtreecommitdiffstats
path: root/apps
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 /apps
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 'apps')
-rw-r--r--apps/app_macro.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 5296e8723..eac1cc157 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -477,6 +477,23 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive)
chan->macropriority = 0;
}
+ /*!\note
+ * This section is used to restore a behavior that we mistakenly
+ * changed in issue #6176, then mistakenly reverted in #13962 and
+ * #13363. A corresponding change is made in main/pbx.c, where we
+ * check this variable for existence, then look for the "h" extension
+ * in that context.
+ */
+ if (ast_check_hangup(chan) || res < 0) {
+ /* Don't need to lock the channel, as we aren't dereferencing emc.
+ * The intent here is to grab the deepest context, without overwriting
+ * in any above context. */
+ const char *emc = pbx_builtin_getvar_helper(chan, "EXIT_MACRO_CONTEXT");
+ if (!emc) {
+ pbx_builtin_setvar_helper(chan, "EXIT_MACRO_CONTEXT", fullmacro);
+ }
+ }
+
if (!strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
chan->priority = oldpriority;