mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-25 22:18:07 +00:00
Save appl and data around exec (bug #1301)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2615 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
15
pbx.c
15
pbx.c
@@ -367,6 +367,10 @@ int pbx_exec(struct ast_channel *c, /* Channel */
|
|||||||
/* This function is special. It saves the stack so that no matter
|
/* This function is special. It saves the stack so that no matter
|
||||||
how many times it is called, it returns to the same place */
|
how many times it is called, it returns to the same place */
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
|
char *saved_c_appl;
|
||||||
|
char *saved_c_data;
|
||||||
|
|
||||||
int stack = c->stack;
|
int stack = c->stack;
|
||||||
int (*execute)(struct ast_channel *chan, void *data) = app->execute;
|
int (*execute)(struct ast_channel *chan, void *data) = app->execute;
|
||||||
if (newstack && stack > AST_CHANNEL_MAX_STACK - 2) {
|
if (newstack && stack > AST_CHANNEL_MAX_STACK - 2) {
|
||||||
@@ -391,11 +395,18 @@ int pbx_exec(struct ast_channel *c, /* Channel */
|
|||||||
} else {
|
} else {
|
||||||
if (c->cdr)
|
if (c->cdr)
|
||||||
ast_cdr_setapp(c->cdr, app->name, data);
|
ast_cdr_setapp(c->cdr, app->name, data);
|
||||||
|
|
||||||
|
// save channel values
|
||||||
|
saved_c_appl= c->appl;
|
||||||
|
saved_c_data= c->data;
|
||||||
|
|
||||||
c->appl = app->name;
|
c->appl = app->name;
|
||||||
c->data = data;
|
c->data = data;
|
||||||
res = execute(c, data);
|
res = execute(c, data);
|
||||||
c->appl = NULL;
|
// restore channel values
|
||||||
c->data = NULL;
|
c->appl= saved_c_appl;
|
||||||
|
c->data= saved_c_data;
|
||||||
|
|
||||||
/* Any application that returns, we longjmp back, just in case. */
|
/* Any application that returns, we longjmp back, just in case. */
|
||||||
if (c->stack != stack + 1)
|
if (c->stack != stack + 1)
|
||||||
ast_log(LOG_WARNING, "Stack is not at expected value\n");
|
ast_log(LOG_WARNING, "Stack is not at expected value\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user