mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-25 07:01:09 +00:00
automerge commit
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@9159 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -104,7 +104,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
char *offsets;
|
char *offsets;
|
||||||
int offset, depth;
|
int offset, depth;
|
||||||
int setmacrocontext=0;
|
int setmacrocontext=0;
|
||||||
int autoloopflag;
|
int autoloopflag, dead = 0;
|
||||||
|
|
||||||
char *save_macro_exten;
|
char *save_macro_exten;
|
||||||
char *save_macro_context;
|
char *save_macro_context;
|
||||||
@@ -216,8 +216,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
switch(res) {
|
switch(res) {
|
||||||
case MACRO_EXIT_RESULT:
|
case MACRO_EXIT_RESULT:
|
||||||
res = 0;
|
res = 0;
|
||||||
goto out;
|
goto out;
|
||||||
case AST_PBX_KEEPALIVE:
|
case AST_PBX_KEEPALIVE:
|
||||||
if (option_debug)
|
if (option_debug)
|
||||||
@@ -231,6 +231,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
ast_log(LOG_DEBUG, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
||||||
else if (option_verbose > 1)
|
else if (option_verbose > 1)
|
||||||
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
ast_verbose( VERBOSE_PREFIX_2 "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
|
||||||
|
dead = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -250,37 +251,44 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
out:
|
out:
|
||||||
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
|
/* Reset the depth back to what it was when the routine was entered (like if we called Macro recursively) */
|
||||||
snprintf(depthc, sizeof(depthc), "%d", depth);
|
snprintf(depthc, sizeof(depthc), "%d", depth);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
|
if (!dead) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_DEPTH", depthc);
|
||||||
|
|
||||||
ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
|
ast_set2_flag(chan, autoloopflag, AST_FLAG_IN_AUTOLOOP);
|
||||||
for (x=1; x<argc; x++) {
|
}
|
||||||
|
|
||||||
|
for (x = 1; x < argc; x++) {
|
||||||
/* Restore old arguments and delete ours */
|
/* Restore old arguments and delete ours */
|
||||||
snprintf(varname, sizeof(varname), "ARG%d", x);
|
snprintf(varname, sizeof(varname), "ARG%d", x);
|
||||||
if (oldargs[x]) {
|
if (oldargs[x]) {
|
||||||
pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
|
if (!dead)
|
||||||
|
pbx_builtin_setvar_helper(chan, varname, oldargs[x]);
|
||||||
free(oldargs[x]);
|
free(oldargs[x]);
|
||||||
} else {
|
} else if (!dead) {
|
||||||
pbx_builtin_setvar_helper(chan, varname, NULL);
|
pbx_builtin_setvar_helper(chan, varname, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restore macro variables */
|
/* Restore macro variables */
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
|
if (!dead) {
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_EXTEN", save_macro_exten);
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
||||||
|
}
|
||||||
if (save_macro_exten)
|
if (save_macro_exten)
|
||||||
free(save_macro_exten);
|
free(save_macro_exten);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_CONTEXT", save_macro_context);
|
|
||||||
if (save_macro_context)
|
if (save_macro_context)
|
||||||
free(save_macro_context);
|
free(save_macro_context);
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_PRIORITY", save_macro_priority);
|
|
||||||
if (save_macro_priority)
|
if (save_macro_priority)
|
||||||
free(save_macro_priority);
|
free(save_macro_priority);
|
||||||
if (setmacrocontext) {
|
|
||||||
|
if (!dead && setmacrocontext) {
|
||||||
chan->macrocontext[0] = '\0';
|
chan->macrocontext[0] = '\0';
|
||||||
chan->macroexten[0] = '\0';
|
chan->macroexten[0] = '\0';
|
||||||
chan->macropriority = 0;
|
chan->macropriority = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcasecmp(chan->context, fullmacro)) {
|
if (!dead && !strcasecmp(chan->context, fullmacro)) {
|
||||||
/* If we're leaving the macro normally, restore original information */
|
/* If we're leaving the macro normally, restore original information */
|
||||||
chan->priority = oldpriority;
|
chan->priority = oldpriority;
|
||||||
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
|
ast_copy_string(chan->context, oldcontext, sizeof(chan->context));
|
||||||
@@ -299,7 +307,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
|
if (!dead)
|
||||||
|
pbx_builtin_setvar_helper(chan, "MACRO_OFFSET", save_macro_offset);
|
||||||
if (save_macro_offset)
|
if (save_macro_offset)
|
||||||
free(save_macro_offset);
|
free(save_macro_offset);
|
||||||
LOCAL_USER_REMOVE(u);
|
LOCAL_USER_REMOVE(u);
|
||||||
|
Reference in New Issue
Block a user