[Asterisk-code-review] res_pjsip_session: Preserve label on incoming re-INVITE. (asterisk[certified/16.8])

Friendly Automation asteriskteam at digium.com
Thu Jun 18 17:48:01 CDT 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14586 )

Change subject: res_pjsip_session: Preserve label on incoming re-INVITE.
......................................................................

res_pjsip_session: Preserve label on incoming re-INVITE.

When a re-INVITE is received we create a new set of
streams that are then swapped in as the active streams.
We did not preserve the SDP label from the previous
streams, resulting in the label getting lost.

This change ensures that if an SDP label is present
on the previous stream then it is set on the new stream.

ASTERISK-28953

Change-Id: I9dd63b88b562fe96ce5c791a3dae5bcaca258445
---
M res/res_pjsip_session.c
1 file changed, 16 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c
index 1bbc6fa..d05f2c5 100644
--- a/res/res_pjsip_session.c
+++ b/res/res_pjsip_session.c
@@ -760,6 +760,14 @@
 				ast_stream_free(stream);
 				return -1;
 			}
+			if (existing_stream) {
+				const char *stream_label = ast_stream_get_metadata(existing_stream, "SDP:LABEL");
+
+				if (!ast_strlen_zero(stream_label)) {
+					ast_stream_set_metadata(stream, "SDP:LABEL", stream_label);
+				}
+			}
+
 			/* For backwards compatibility with the core the default audio stream is always sendrecv */
 			if (!ast_sip_session_is_pending_stream_default(session, stream) || strcmp(media, "audio")) {
 				if (pjmedia_sdp_media_find_attr2(remote_stream, "sendonly", NULL)) {
@@ -1964,6 +1972,14 @@
 			return -1;
 		}
 
+		if (existing_stream) {
+			const char *stream_label = ast_stream_get_metadata(existing_stream, "SDP:LABEL");
+
+			if (!ast_strlen_zero(stream_label)) {
+				ast_stream_set_metadata(stream, "SDP:LABEL", stream_label);
+			}
+		}
+
 		session_media = ast_sip_session_media_state_add(session, session->pending_media_state, ast_media_type_from_str(media), i);
 		if (!session_media) {
 			return -1;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14586
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: certified/16.8
Gerrit-Change-Id: I9dd63b88b562fe96ce5c791a3dae5bcaca258445
Gerrit-Change-Number: 14586
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200618/e64ad0d6/attachment.html>


More information about the asterisk-code-review mailing list