[Asterisk-code-review] bridge_simple.c: Unhold channels on join simple bridge. (asterisk[master])

Friendly Automation asteriskteam at digium.com
Tue Apr 26 15:09:05 CDT 2022


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18442 )

Change subject: bridge_simple.c: Unhold channels on join simple bridge.
......................................................................

bridge_simple.c: Unhold channels on join simple bridge.

Patch provided inline by Yury Kirsanov on the linked issue and
approved by Josh Colp.

ASTERISK-29253 #close

Change-Id: I5b9ccc67ebf06e875ed061d9e7fc21f47b0a4e1f
---
M bridges/bridge_simple.c
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c
index 1e224f7..ba300ed 100644
--- a/bridges/bridge_simple.c
+++ b/bridges/bridge_simple.c
@@ -128,6 +128,7 @@
 	struct ast_stream_topology *new_top;
 	struct ast_channel *c0 = AST_LIST_FIRST(&bridge->channels)->chan;
 	struct ast_channel *c1 = AST_LIST_LAST(&bridge->channels)->chan;
+	int unhold_c0, unhold_c1;
 
 	/*
 	 * If this is the first channel we can't make it compatible...
@@ -152,9 +153,29 @@
 		SWAP(c0, c1);
 	}
 	new_top = simple_bridge_request_stream_topology_update(existing_top, req_top);
+
+	/* The ast_channel_hold_state() and ast_channel_name() accessors need to be
+	 * called with the associated channel lock held.
+	 */
+	if ((unhold_c1 = ast_channel_hold_state(c1) == AST_CONTROL_HOLD)) {
+		ast_debug(1, "Channel %s simulating UNHOLD for bridge simple join.\n", ast_channel_name(c1));
+	}
+
+	if ((unhold_c0 = ast_channel_hold_state(c0) == AST_CONTROL_HOLD)) {
+		ast_debug(1, "Channel %s simulating UNHOLD for bridge simple join.\n", ast_channel_name(c0));
+	}
+
 	ast_channel_unlock(c0);
 	ast_channel_unlock(c1);
 
+	if (unhold_c1) {
+		ast_indicate(c1, AST_CONTROL_UNHOLD);
+	}
+
+	if (unhold_c0) {
+		ast_indicate(c0, AST_CONTROL_UNHOLD);
+	}
+
 	if (!new_top) {
 		/* Failure.  We'll just have to live with the current topology. */
 		return 0;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18442
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I5b9ccc67ebf06e875ed061d9e7fc21f47b0a4e1f
Gerrit-Change-Number: 18442
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220426/6a41025e/attachment.html>


More information about the asterisk-code-review mailing list