[asterisk-commits] bridge native rtp: Handle case where channel joins already s... (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Feb 28 14:50:27 CST 2017


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/5091 )

Change subject: bridge_native_rtp: Handle case where channel joins already suspended.
......................................................................


bridge_native_rtp: Handle case where channel joins already suspended.

The bridge_native_rtp module did not properly handle the case where
a smart bridge operation occurs while a channel is suspended. In this
scenario the module would incorrectly set up local or remote RTP
bridging despite the media having to flow through Asterisk. The remote
endpoint would see two media streams and experience wonky audio.

The module has been changed so that it ensures both channels are
not suspended when performing the native RTP bridging and this
requirement has been documented in the bridge technology.

ASTERISK-26781

Change-Id: Id4022d73ace837d4a293106445e3ade10dbc7c7c
---
M bridges/bridge_native_rtp.c
M include/asterisk/bridge_technology.h
2 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Sean Bright: Looks good to me, but someone else must approve
  Joshua Colp: Verified



diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index e04c1ca..919df83 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -131,7 +131,7 @@
 {
 	struct ast_bridge_channel *bc0 = AST_LIST_FIRST(&bridge->channels);
 	struct ast_bridge_channel *bc1 = AST_LIST_LAST(&bridge->channels);
-	enum ast_rtp_glue_result native_type;
+	enum ast_rtp_glue_result native_type = AST_RTP_GLUE_RESULT_FORBID;
 	struct ast_rtp_glue *glue0, *glue1;
 	RAII_VAR(struct ast_rtp_instance *, instance0, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_rtp_instance *, instance1, NULL, ao2_cleanup);
@@ -147,7 +147,9 @@
 	}
 
 	ast_channel_lock_both(bc0->chan, bc1->chan);
-	native_type = native_rtp_bridge_get(bc0->chan, bc1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+	if (!bc0->suspended && !bc1->suspended) {
+		native_type = native_rtp_bridge_get(bc0->chan, bc1->chan, &glue0, &glue1, &instance0, &instance1, &vinstance0, &vinstance1);
+	}
 
 	switch (native_type) {
 	case AST_RTP_GLUE_RESULT_LOCAL:
diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h
index 8df19d9..843d93c 100644
--- a/include/asterisk/bridge_technology.h
+++ b/include/asterisk/bridge_technology.h
@@ -110,6 +110,9 @@
 	 *
 	 * \note The bridge technology must tollerate 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.
 	 */
 	int (*join)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
 	/*!

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Id4022d73ace837d4a293106445e3ade10dbc7c7c
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-commits mailing list