aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/app_stack.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/apps/app_stack.c b/apps/app_stack.c
index 7131a8d3c..b0f703bb6 100644
--- a/apps/app_stack.c
+++ b/apps/app_stack.c
@@ -451,9 +451,16 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **arg
chan->priority = 0;
if ((res = pbx_exec(chan, theapp, gosub_args)) == 0) {
+ struct ast_pbx *pbx = chan->pbx;
+ /* Suppress warning about PBX already existing */
+ chan->pbx = NULL;
ast_agi_fdprintf(chan, agi->fd, "100 result=0 Trying...\n");
ast_pbx_run(chan);
ast_agi_fdprintf(chan, agi->fd, "200 result=0 Gosub complete\n");
+ if (chan->pbx) {
+ ast_free(chan->pbx);
+ }
+ chan->pbx = pbx;
} else {
ast_agi_fdprintf(chan, agi->fd, "200 result=%d Gosub failed\n", res);
}