[asterisk-commits] res pjsip session: Preserve stream name during renegotiation. (asterisk[15.0])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 7 12:51:43 CDT 2017


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

Change subject: res_pjsip_session: Preserve stream name during renegotiation.
......................................................................

res_pjsip_session: Preserve stream name during renegotiation.

Stream names within Asterisk can have meaning so when an externally
initiated renegotiation occurs we need to preserve the name of
the stream if it already exists.

Change-Id: I29f50d0cc7f3238287d6d647777e76e1bdf8c596
---
M res/res_pjsip_session.c
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Joshua Colp: Approved for Submit



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 76550ed..b6fa8bb 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -588,7 +588,14 @@
 			stream = ast_stream_topology_get_stream(session->pending_media_state->topology, i);
 		}
 		if (!stream) {
-			stream = ast_stream_alloc(ast_codec_media_type2str(type), type);
+			struct ast_stream *existing_stream = NULL;
+
+			if (session->active_media_state->topology &&
+				(i < ast_stream_topology_get_count(session->active_media_state->topology))) {
+				existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);
+			}
+
+			stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);
 			if (!stream) {
 				return -1;
 			}
@@ -1586,6 +1593,7 @@
 		char media[20];
 		struct ast_sip_session_sdp_handler *handler;
 		RAII_VAR(struct sdp_handler_list *, handler_list, NULL, ao2_cleanup);
+		struct ast_stream *existing_stream = NULL;
 		struct ast_stream *stream;
 		enum ast_media_type type;
 		struct ast_sip_session_media *session_media = NULL;
@@ -1594,8 +1602,13 @@
 		/* We need a null-terminated version of the media string */
 		ast_copy_pj_str(media, &sdp->media[i]->desc.media, sizeof(media));
 
+		if (session->active_media_state->topology &&
+			(i < ast_stream_topology_get_count(session->active_media_state->topology))) {
+			existing_stream = ast_stream_topology_get_stream(session->active_media_state->topology, i);
+		}
+
 		type = ast_media_type_from_str(media);
-		stream = ast_stream_alloc(ast_codec_media_type2str(type), type);
+		stream = ast_stream_alloc(existing_stream ? ast_stream_get_name(existing_stream) : ast_codec_media_type2str(type), type);
 		if (!stream) {
 			return -1;
 		}

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

Gerrit-Project: asterisk
Gerrit-Branch: 15.0
Gerrit-MessageType: merged
Gerrit-Change-Id: I29f50d0cc7f3238287d6d647777e76e1bdf8c596
Gerrit-Change-Number: 6393
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20170907/ecbb7891/attachment-0001.html>


More information about the asterisk-commits mailing list