[Asterisk-code-review] bridge native rtp : update peer channel's RTP when receiving... (asterisk[14])

Jean Aunis - Prescom asteriskteam at digium.com
Thu Sep 7 04:48:49 CDT 2017


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


Change subject: bridge_native_rtp : update peer channel's RTP when receiving an ANSWER frame
......................................................................

bridge_native_rtp : update peer channel's RTP when receiving an ANSWER frame

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 updates the peer channel's RTP description when an AST_CONTROL_ANSWER
frame is written to the bridge.

ASTERISK-27257

Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
---
M bridges/bridge_native_rtp.c
1 file changed, 24 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/62/6462/1

diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index a166258..6dabb3e 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -345,8 +345,9 @@
 		}
 
 		/*
-		 * If we have a target, it's the channel that received the UNHOLD or
-		 * UPDATE_RTP_PEER frame and was told to resume
+		 * We may have a target for two reasons :
+		 * - the channel that received the UNHOLD or UPDATE_RTP_PEER frame and was told to resume
+		 * - the other channel answered
 		 */
 		if (!target) {
 			/* Send both channels to remote */
@@ -358,10 +359,10 @@
 				ast_channel_name(bc0->chan), ast_channel_name(bc1->chan));
 		} else {
 			/*
-			 * If a target was provided, it is the recipient of an unhold or an update and needs to have
-			 * its media redirected to fit the current remote bridging needs. The other channel is either
-			 * already set up to handle the new media path or will have its own set of updates independent
-			 * of this pass.
+			 * If a target was provided, it is the recipient of an unhold or an update, or its peer answered.
+			 * Anyway, it needs to have its media redirected to fit the current remote bridging needs.
+			 * The other channel is either already set up to handle the new media path or will have its
+			 * own set of updates independent of this pass.
 			 */
 			ast_debug(2, "Bridge '%s'.  Sending '%s' back to remote\n",
 				bridge->uniqueid, ast_channel_name(target));
@@ -890,8 +891,25 @@
 static int native_rtp_bridge_write(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame)
 {
 	const struct ast_control_t38_parameters *t38_parameters;
+	struct ast_channel *peer_chan;
 	int defer = 0;
 
+	if(frame->frametype == AST_FRAME_CONTROL
+		&& frame->subclass.integer == AST_CONTROL_ANSWER) {
+		/*
+		 * The channel answered, and then is likely to have updated
+		 * its media description. We need to update the bridged channel.
+		 */
+		if(bridge_channel == AST_LIST_FIRST(&bridge->channels)) {
+			peer_chan = AST_LIST_LAST(&bridge->channels)->chan;
+		} else {
+			peer_chan = AST_LIST_FIRST(&bridge->channels)->chan;
+		}
+		ast_verb(4, "%s answered, updating media on peer channel %s\n",
+			ast_channel_name(bridge_channel->chan), ast_channel_name(peer_chan));
+		native_rtp_bridge_start(bridge, peer_chan);
+	}
+
 	if (!ast_bridge_queue_everyone_else(bridge, bridge_channel, frame)) {
 		/* This frame was successfully queued so no need to defer */
 		return 0;

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

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: If1aaee1b4ed9658a1aa91ab715ee0a6413b878df
Gerrit-Change-Number: 6462
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/20170907/1f08704d/attachment.html>


More information about the asterisk-code-review mailing list