aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_macro.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-09 23:46:49 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-09 23:46:49 +0000
commitb5dfede5e4a0a446a83413e3a42ea77e60f08c7f (patch)
tree625627428137eeb508f11905473aec45f23e0ea0 /apps/app_macro.c
parentf962b1a42b7c89034779da9b08e7e6aaef23e4d5 (diff)
Make macro preserve context
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@807 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_macro.c')
-rwxr-xr-xapps/app_macro.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 0b4a11fc4..4a84e011d 100755
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -115,7 +115,10 @@ static int macro_exec(struct ast_channel *chan, void *data)
/* Setup environment for new run */
strcpy(chan->exten, "s");
+#if 0
+ /* Don't overwrite it because sometimes we have to know the real context */
strncpy(chan->context, fullmacro, sizeof(chan->context));
+#endif
chan->priority = 1;
while((cur = strsep(&rest, "|")) && (argc < MAX_ARGS)) {
@@ -128,8 +131,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
pbx_builtin_setvar_helper(chan, varname, cur);
argc++;
}
- while(ast_exists_extension(chan, chan->context, chan->exten, chan->priority, chan->callerid)) {
- if ((res = ast_spawn_extension(chan, chan->context, chan->exten, chan->priority, chan->callerid))) {
+ while(ast_exists_extension(chan, fullmacro, chan->exten, chan->priority, chan->callerid)) {
+ if ((res = ast_spawn_extension(chan, fullmacro, chan->exten, chan->priority, chan->callerid))) {
/* Something bad happened, or a hangup has been requested. */
if (((res >= '0') && (res <= '9')) || ((res >= 'A') && (res <= 'F'))) {
/* Just return result as to the previous application as if it had been dialed */
@@ -152,7 +155,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
goto out;
}
}
- if (strcasecmp(chan->context, fullmacro)) {
+ if (strcmp(chan->context, oldcontext) || strcmp(chan->exten, "s")) {
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Channel '%s' jumping out of macro '%s'\n", chan->name, macro);
break;