[Asterisk-code-review] bridge : Fix one-way direct-media when early bridging with n... (asterisk[13])

Jenkins2 asteriskteam at digium.com
Thu Sep 21 10:35:33 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6495 )

Change subject: bridge : Fix one-way direct-media when early bridging with native_rtp
......................................................................

bridge : Fix one-way direct-media when early bridging with native_rtp

When two channels were early bridged in a native_rtp bridge, the RTP description
on one side was not updated when the other side answered.
This patch forbids non-answered channels to enter a native_rtp bridge, and
triggers a bridge reconfiguration when an ANSWER frame is received.

ASTERISK-27257

Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
---
M bridges/bridge_native_rtp.c
M include/asterisk/bridge_technology.h
M main/bridge_channel.c
3 files changed, 9 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index 58af24c..122c132 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -600,7 +600,8 @@
  */
 static int native_rtp_bridge_capable(struct ast_channel *chan)
 {
-	return !ast_channel_has_hook_requiring_audio(chan);
+	return !ast_channel_has_hook_requiring_audio(chan)
+			&& ast_channel_state(chan) == AST_STATE_UP;
 }
 
 /*!
diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h
index 5add455..e4091e0 100644
--- a/include/asterisk/bridge_technology.h
+++ b/include/asterisk/bridge_technology.h
@@ -108,11 +108,13 @@
 	 *
 	 * \note On entry, bridge is already locked.
 	 *
-	 * \note The bridge technology must tollerate a failed to join channel
+	 * \note The bridge technology must tolerate a failed to join channel
 	 * until it can be kicked from the bridge.
 	 *
 	 * \note A channel may be in a suspended state already when joining a bridge
 	 * technology. The technology must handle this case.
+	 *
+	 * \note A channel may not be answered when joining a bridge technology.
 	 */
 	int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*!
diff --git a/main/bridge_channel.c b/main/bridge_channel.c
index 0af688a..08aea5b 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -2258,6 +2258,10 @@
 	case AST_CONTROL_ANSWER:
 		if (ast_channel_state(chan) != AST_STATE_UP) {
 			ast_answer(chan);
+			ast_bridge_channel_lock_bridge(bridge_channel);
+			bridge_channel->bridge->reconfigured = 1;
+			bridge_reconfigured(bridge_channel->bridge, 0);
+			ast_bridge_unlock(bridge_channel->bridge);
 		} else {
 			ast_indicate(chan, -1);
 		}

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
Gerrit-Change-Number: 6495
Gerrit-PatchSet: 2
Gerrit-Owner: Jean Aunis - Prescom <jean.aunis at prescom.fr>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170921/97a3441d/attachment.html>


More information about the asterisk-code-review mailing list