From: Peter Jannesen Date: Thu, 13 Mar 2025 21:52:53 +0000 (+0100) Subject: action_redirect: remove after_bridge_goto_info X-Git-Tag: 21.9.0-rc1~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43a92df3fdc7fe825cad3d4e301141f069451cf1;p=thirdparty%2Fasterisk.git action_redirect: remove after_bridge_goto_info Under certain circumstances the context/extens/prio are stored in the after_bridge_goto_info. This info is used when the bridge is broken by for hangup of the other party. In the situation that the bridge is broken by an AMI Redirect this info is not used but also not removed. With the result that when the channel is put back in a bridge and the bridge is broken the execution continues at the wrong context/extens/prio. Resolves: #1144 (cherry picked from commit 6881b6249f43585f8ed1f047b8a8f0a3922394db) --- diff --git a/main/manager.c b/main/manager.c index 8325fb0750..9eecda634f 100644 --- a/main/manager.c +++ b/main/manager.c @@ -96,6 +96,7 @@ #include "asterisk/test.h" #include "asterisk/json.h" #include "asterisk/bridge.h" +#include "asterisk/bridge_after.h" #include "asterisk/features_config.h" #include "asterisk/rtp_engine.h" #include "asterisk/format_cache.h" @@ -3946,6 +3947,12 @@ static int action_sendtext(struct mansession *s, const struct message *m) return 0; } +static int async_goto_with_discard_bridge_after(struct ast_channel *chan, const char *context, const char *exten, int priority) +{ + ast_bridge_discard_after_goto(chan); + return ast_async_goto(chan, context, exten, priority); +} + /*! \brief action_redirect: The redirect manager command */ static int action_redirect(struct mansession *s, const struct message *m) { @@ -4024,7 +4031,7 @@ static int action_redirect(struct mansession *s, const struct message *m) if (ast_strlen_zero(name2)) { /* Single channel redirect in progress. */ - res = ast_async_goto(chan, context, exten, pi); + res = async_goto_with_discard_bridge_after(chan, context, exten, pi); if (!res) { astman_send_ack(s, m, "Redirect successful"); } else { @@ -4063,12 +4070,12 @@ static int action_redirect(struct mansession *s, const struct message *m) } ast_channel_unlock(chan2); - res = ast_async_goto(chan, context, exten, pi); + res = async_goto_with_discard_bridge_after(chan, context, exten, pi); if (!res) { if (!ast_strlen_zero(context2)) { - res = ast_async_goto(chan2, context2, exten2, pi2); + res = async_goto_with_discard_bridge_after(chan2, context2, exten2, pi2); } else { - res = ast_async_goto(chan2, context, exten, pi); + res = async_goto_with_discard_bridge_after(chan2, context, exten, pi); } if (!res) { astman_send_ack(s, m, "Dual Redirect successful");