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

Jean Aunis - Prescom asteriskteam at digium.com
Thu Sep 14 07:14:14 CDT 2017


Jean Aunis - Prescom has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/95/6495/1

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..5c76fae 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -2212,10 +2212,12 @@
 static void bridge_channel_handle_control(struct ast_bridge_channel *bridge_channel, struct ast_frame *fr)
 {
 	struct ast_channel *chan;
+	struct ast_bridge *bridge;
 	struct ast_option_header *aoh;
 	int is_caller;
 
 	chan = bridge_channel->chan;
+	bridge = bridge_channel->bridge;
 	switch (fr->subclass.integer) {
 	case AST_CONTROL_REDIRECTING:
 		is_caller = !ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING);
@@ -2258,6 +2260,8 @@
 	case AST_CONTROL_ANSWER:
 		if (ast_channel_state(chan) != AST_STATE_UP) {
 			ast_answer(chan);
+			bridge->reconfigured = 1;
+			bridge_reconfigured(bridge, 0);
 		} 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: newchange
Gerrit-Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
Gerrit-Change-Number: 6495
Gerrit-PatchSet: 1
Gerrit-Owner: Jean Aunis - Prescom <jean.aunis at prescom.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170914/6fac3f00/attachment-0001.html>


More information about the asterisk-code-review mailing list