diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index d92840fce419e3df93c5948f5dbc1d6122f1867c..462942724336145a42ed3bcec4be62e047207ab6 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -72,7 +72,7 @@ static int asyncgoto_exec(struct ast_channel *chan, void *data) return -1; } - res = ast_parseable_goto(chan2, args.label); + res = ast_async_parseable_goto(chan2, args.label); ast_channel_unlock(chan2); diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index 1082c74b2240f21a2565321ed92252fd5193fb78..1ba9b0d70955596ec8be4f45e36f9126d14a7da8 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -861,6 +861,11 @@ int ast_goto_if_exists(struct ast_channel *chan, const char *context, const char */ int ast_parseable_goto(struct ast_channel *chan, const char *goto_string); +/*! + * \note This function will handle locking the channel as needed. + */ +int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string); + /*! * \note This function will handle locking the channel as needed. */ diff --git a/main/pbx.c b/main/pbx.c index e584ea07d8aa80e58f5947367853d5e85c4a703c..e59ee9ea8948d2fd9da417b124c9597f2d141faa 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -7792,7 +7792,7 @@ int ast_async_goto_if_exists(struct ast_channel *chan, const char * context, con return __ast_goto_if_exists(chan, context, exten, priority, 1); } -int ast_parseable_goto(struct ast_channel *chan, const char *goto_string) +static int pbx_parseable_goto(struct ast_channel *chan, const char *goto_string, int async) { char *exten, *pri, *context; char *stringp; @@ -7836,8 +7836,22 @@ int ast_parseable_goto(struct ast_channel *chan, const char *goto_string) if (mode) ipri = chan->priority + (ipri * mode); - ast_explicit_goto(chan, context, exten, ipri); + if (async) + ast_async_goto(chan, context, exten, ipri); + else + ast_explicit_goto(chan, context, exten, ipri); + ast_cdr_update(chan); return 0; } + +int ast_parseable_goto(struct ast_channel *chan, const char *goto_string) +{ + return pbx_parseable_goto(chan, goto_string, 0); +} + +int ast_async_parseable_goto(struct ast_channel *chan, const char *goto_string) +{ + return pbx_parseable_goto(chan, goto_string, 1); +}