mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-08 19:08:14 +00:00
Make parking resume properly when in macro
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1270 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -98,6 +98,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
|
strncpy(oldcontext, chan->context, sizeof(oldcontext) - 1);
|
||||||
if (!strlen(chan->macrocontext)) {
|
if (!strlen(chan->macrocontext)) {
|
||||||
strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
|
strncpy(chan->macrocontext, chan->context, sizeof(chan->macrocontext) - 1);
|
||||||
|
strncpy(chan->macroexten, chan->exten, sizeof(chan->macroexten) - 1);
|
||||||
|
chan->macropriority = chan->priority;
|
||||||
setmacrocontext=1;
|
setmacrocontext=1;
|
||||||
}
|
}
|
||||||
argc = 1;
|
argc = 1;
|
||||||
@@ -190,8 +192,11 @@ out:
|
|||||||
if (save_macro_context) free(save_macro_context);
|
if (save_macro_context) free(save_macro_context);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
||||||
if (save_macro_priority) free(save_macro_priority);
|
if (save_macro_priority) free(save_macro_priority);
|
||||||
if (setmacrocontext)
|
if (setmacrocontext) {
|
||||||
strcpy(chan->macrocontext, "");
|
strcpy(chan->macrocontext, "");
|
||||||
|
strcpy(chan->macroexten, "");
|
||||||
|
chan->macropriority = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strcasecmp(chan->context, fullmacro)) {
|
if (!strcasecmp(chan->context, fullmacro)) {
|
||||||
/* If we're leaving the macro normally, restore original information */
|
/* If we're leaving the macro normally, restore original information */
|
||||||
|
|||||||
@@ -158,6 +158,10 @@ struct ast_channel {
|
|||||||
char context[AST_MAX_EXTENSION];
|
char context[AST_MAX_EXTENSION];
|
||||||
/*! Current non-macro context */
|
/*! Current non-macro context */
|
||||||
char macrocontext[AST_MAX_EXTENSION];
|
char macrocontext[AST_MAX_EXTENSION];
|
||||||
|
/*! Current non-macro extension */
|
||||||
|
char macroexten[AST_MAX_EXTENSION];
|
||||||
|
/*! Current non-macro priority */
|
||||||
|
int macropriority;
|
||||||
/*! Current extension number */
|
/*! Current extension number */
|
||||||
char exten[AST_MAX_EXTENSION];
|
char exten[AST_MAX_EXTENSION];
|
||||||
/* Current extension priority */
|
/* Current extension priority */
|
||||||
|
|||||||
@@ -137,9 +137,18 @@ int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeou
|
|||||||
*extout = x;
|
*extout = x;
|
||||||
/* Remember what had been dialed, so that if the parking
|
/* Remember what had been dialed, so that if the parking
|
||||||
expires, we try to come back to the same place */
|
expires, we try to come back to the same place */
|
||||||
strncpy(pu->context, chan->context, sizeof(pu->context)-1);
|
if (strlen(chan->macrocontext))
|
||||||
strncpy(pu->exten, chan->exten, sizeof(pu->exten)-1);
|
strncpy(pu->context, chan->macrocontext, sizeof(pu->context)-1);
|
||||||
pu->priority = chan->priority;
|
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;
|
pu->next = parkinglot;
|
||||||
parkinglot = pu;
|
parkinglot = pu;
|
||||||
ast_pthread_mutex_unlock(&parking_lock);
|
ast_pthread_mutex_unlock(&parking_lock);
|
||||||
|
|||||||
Reference in New Issue
Block a user