[Asterisk-code-review] bridge.c: Hangup attended transfer target if bridged (asterisk[certified/13.1])

Richard Mudgett asteriskteam at digium.com
Wed Apr 20 16:55:25 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/2667

Change subject: bridge.c: Hangup attended transfer target if bridged
......................................................................

bridge.c: Hangup attended transfer target if bridged

After completing an attended transfer the transfer target channel was not being
hung up after leaving the bridge. Added an explicit softhangup to hangup said
channel, but only if it was previously bridged.

ASTERISK-24782 #close
Reported by: John Bigelow

This patch is a remedial cherry-pick from v13.

Change-Id: Idde9543d56842369384a5e8c00d72a22bbc39ada
---
M main/bridge.c
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/67/2667/1

diff --git a/main/bridge.c b/main/bridge.c
index f621942..0925ac1 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -4461,6 +4461,7 @@
 	int do_bridge_transfer;
 	enum ast_transfer_result res;
 	const char *app = NULL;
+	int hangup_target = 0;
 
 	to_transferee_bridge = acquire_bridge(to_transferee);
 	to_target_bridge = acquire_bridge(to_transfer_target);
@@ -4540,7 +4541,7 @@
 		ast_bridge_unlock(to_transferee_bridge);
 		ast_bridge_unlock(to_target_bridge);
 
-		ast_softhangup(to_transfer_target, AST_SOFTHANGUP_DEV);
+		hangup_target = 1;
 		goto end;
 	}
 
@@ -4583,6 +4584,11 @@
 	set_transfer_variables_all(to_transferee, channels, 1);
 
 	if (do_bridge_transfer) {
+		/*
+		 * Hang up the target if it was bridged. Note, if it is not bridged
+		 * it is hung up during the masquerade.
+		 */
+		hangup_target = chan_bridged == to_transfer_target;
 		ast_bridge_lock(the_bridge);
 		res = attended_transfer_bridge(chan_bridged, chan_unbridged, the_bridge, NULL, transfer_msg);
 		ast_bridge_unlock(the_bridge);
@@ -4606,6 +4612,10 @@
 	res = AST_BRIDGE_TRANSFER_SUCCESS;
 
 end:
+	if (res == AST_BRIDGE_TRANSFER_SUCCESS && hangup_target) {
+		ast_softhangup(to_transfer_target, AST_SOFTHANGUP_DEV);
+	}
+
 	transfer_msg->result = res;
 	ast_bridge_publish_attended_transfer(transfer_msg);
 	return res;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idde9543d56842369384a5e8c00d72a22bbc39ada
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list