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

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


Jean Aunis - Prescom has uploaded this change for review. ( https://gerrit.asterisk.org/6497


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/97/6497/1

diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index a46b420..edbfe58 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -598,7 +598,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 def7b19..eaea28d 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 66292bf..4fe8d81 100644
--- a/main/bridge_channel.c
+++ b/main/bridge_channel.c
@@ -2267,10 +2267,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);
@@ -2313,6 +2315,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/6497
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
Gerrit-Change-Number: 6497
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/76abaa78/attachment.html>


More information about the asterisk-code-review mailing list