aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xapps/app_macro.c7
-rwxr-xr-xinclude/asterisk/channel.h4
-rwxr-xr-xres/res_parking.c15
3 files changed, 22 insertions, 4 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 3e102454b..331e55072 100755
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -98,6 +98,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
if (!strlen(chan->macrocontext)) {
strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
+ strncpy(chan->macroexten, chan->exten, sizeof(chan->macroexten) - 1);
+ chan->macropriority = chan->priority;
setmacrocontext=1;
}
argc = 1;
@@ -190,8 +192,11 @@ out:
if (save_macro_context) free(save_macro_context);
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
if (save_macro_priority) free(save_macro_priority);
- if (setmacrocontext)
+ if (setmacrocontext) {
strcpy(chan->macrocontext, "");
+ strcpy(chan->macroexten, "");
+ chan->macropriority = 0;
+ }
if (!strcasecmp(chan->context, fullmacro)) {
/* If we're leaving the macro normally, restore original information */
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 107e70da4..5fe9d2275 100755
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -158,6 +158,10 @@ struct ast_channel {
char context[AST_MAX_EXTENSION];
/*! Current non-macro context */
char macrocontext[AST_MAX_EXTENSION];
+ /*! Current non-macro extension */
+ char macroexten[AST_MAX_EXTENSION];
+ /*! Current non-macro priority */
+ int macropriority;
/*! Current extension number */
char exten[AST_MAX_EXTENSION];
/* Current extension priority */
diff --git a/res/res_parking.c b/res/res_parking.c
index 13bdbaf6b..821dcee79 100755
--- a/res/res_parking.c
+++ b/res/res_parking.c
@@ -137,9 +137,18 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
*extout = x;
/* Remember what had been dialed, so that if the parking
expires, we try to come back to the same place */
- strncpy(pu->context, chan->context, sizeof(pu->context)-1);
- strncpy(pu->exten, chan->exten, sizeof(pu->exten)-1);
- pu->priority = chan->priority;
+ if (strlen(chan->macrocontext))
+ strncpy(pu->context, chan->macrocontext, sizeof(pu->context)-1);
+ else
+ strncpy(pu->context, chan->context, sizeof(pu->context)-1);
+ if (strlen(chan->macroexten))
+ strncpy(pu->exten, chan->macroexten, sizeof(pu->exten)-1);
+ else
+ strncpy(pu->exten, chan->exten, sizeof(pu->exten)-1);
+ if (chan->macropriority)
+ pu->priority = chan->macropriority;
+ else
+ pu->priority = chan->priority;
pu->next = parkinglot;
parkinglot = pu;
ast_pthread_mutex_unlock(&parking_lock);