[asterisk-commits] bridge basic.c: Fix GOTO ON BLINDXFR (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 28 09:44:24 CST 2015


Matt Jordan has submitted this change and it was merged.

Change subject: bridge_basic.c: Fix GOTO_ON_BLINDXFR
......................................................................


bridge_basic.c: Fix GOTO_ON_BLINDXFR

Use of GOTO_ON_BLINDXFR would not work at all.  The target location would
never be executed by the transferring channel.

* Made feature_blind_transfer() call ast_bridge_set_after_go_on() with
valid context, exten, and priority parameters from the transferring
channel.

* Renamed some feature_blind_transfer() local variables for clarity.

ASTERISK-25641 #close
Reported by Dmitry Melekhov

Change-Id: I19bead9ffdc4aee8d58c654ca05a198da1e4b7ac
---
M main/bridge_basic.c
1 file changed, 19 insertions(+), 8 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/bridge_basic.c b/main/bridge_basic.c
index 3bbd173..29b3f37 100644
--- a/main/bridge_basic.c
+++ b/main/bridge_basic.c
@@ -3385,35 +3385,46 @@
 /*! \brief Internal built in feature for blind transfers */
 static int feature_blind_transfer(struct ast_bridge_channel *bridge_channel, void *hook_pvt)
 {
-	char exten[AST_MAX_EXTENSION] = "";
+	char xfer_exten[AST_MAX_EXTENSION] = "";
 	struct ast_bridge_features_blind_transfer *blind_transfer = hook_pvt;
-	const char *context;
+	const char *xfer_context;
 	char *goto_on_blindxfr;
 
 	ast_bridge_channel_write_hold(bridge_channel, NULL);
 
 	ast_channel_lock(bridge_channel->chan);
-	context = ast_strdupa(get_transfer_context(bridge_channel->chan,
+	xfer_context = ast_strdupa(get_transfer_context(bridge_channel->chan,
 		blind_transfer ? blind_transfer->context : NULL));
 	goto_on_blindxfr = ast_strdupa(S_OR(pbx_builtin_getvar_helper(bridge_channel->chan,
 		"GOTO_ON_BLINDXFR"), ""));
 	ast_channel_unlock(bridge_channel->chan);
 
 	/* Grab the extension to transfer to */
-	if (grab_transfer(bridge_channel->chan, exten, sizeof(exten), context)) {
+	if (grab_transfer(bridge_channel->chan, xfer_exten, sizeof(xfer_exten), xfer_context)) {
 		ast_bridge_channel_write_unhold(bridge_channel);
 		return 0;
 	}
 
 	if (!ast_strlen_zero(goto_on_blindxfr)) {
+		const char *chan_context;
+		const char *chan_exten;
+		int chan_priority;
+
 		ast_debug(1, "After transfer, transferer %s goes to %s\n",
 				ast_channel_name(bridge_channel->chan), goto_on_blindxfr);
-		ast_bridge_set_after_go_on(bridge_channel->chan, NULL, NULL, 0, goto_on_blindxfr);
+
+		ast_channel_lock(bridge_channel->chan);
+		chan_context = ast_strdupa(ast_channel_context(bridge_channel->chan));
+		chan_exten = ast_strdupa(ast_channel_exten(bridge_channel->chan));
+		chan_priority = ast_channel_priority(bridge_channel->chan);
+		ast_channel_unlock(bridge_channel->chan);
+		ast_bridge_set_after_go_on(bridge_channel->chan,
+			chan_context, chan_exten, chan_priority, goto_on_blindxfr);
 	}
 
-	if (ast_bridge_transfer_blind(0, bridge_channel->chan, exten, context, blind_transfer_cb,
-			bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS &&
-			!ast_strlen_zero(goto_on_blindxfr)) {
+	if (ast_bridge_transfer_blind(0, bridge_channel->chan, xfer_exten, xfer_context,
+		blind_transfer_cb, bridge_channel->chan) != AST_BRIDGE_TRANSFER_SUCCESS
+		&& !ast_strlen_zero(goto_on_blindxfr)) {
 		ast_bridge_discard_after_goto(bridge_channel->chan);
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/1859
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I19bead9ffdc4aee8d58c654ca05a198da1e4b7ac
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list