[asterisk-commits] res pjsip sdp rtp.c: Set preferred rx payload type mapping o... (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 21 08:39:25 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: res_pjsip_sdp_rtp.c: Set preferred rx payload type mapping on incoming offers.
......................................................................


res_pjsip_sdp_rtp.c: Set preferred rx payload type mapping on incoming offers.

ASTERISK-25166
Reported by: Kevin Harwell

ASTERISK-17410
Reported by: Boris Fox

Change-Id: I97ecebc1ab9b5654fb918bf1f4c98c956b852369
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 13 insertions(+), 4 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Ashley Sanders: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 2ca1f98..f1314f5 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -286,8 +286,10 @@
 	}
 }
 
-static int set_caps(struct ast_sip_session *session, struct ast_sip_session_media *session_media,
-		    const struct pjmedia_sdp_media *stream)
+static int set_caps(struct ast_sip_session *session,
+	struct ast_sip_session_media *session_media,
+	const struct pjmedia_sdp_media *stream,
+	int is_offer)
 {
 	RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_format_cap *, peer, NULL, ao2_cleanup);
@@ -332,6 +334,13 @@
 		return -1;
 	}
 
+	if (is_offer) {
+		/*
+		 * Setup rx payload type mapping to prefer the mapping
+		 * from the peer that the RFC says we SHOULD use.
+		 */
+		ast_rtp_codecs_payloads_xover(&codecs, &codecs, NULL);
+	}
 	ast_rtp_codecs_payloads_copy(&codecs, ast_rtp_instance_get_codecs(session_media->rtp),
 		session_media->rtp);
 
@@ -901,7 +910,7 @@
 		pj_strdup(session->inv_session->pool, &session_media->transport, &stream->desc.transport);
  	}
 
-	if (set_caps(session, session_media, stream)) {
+	if (set_caps(session, session_media, stream, 1)) {
 		return 0;
 	}
 	return 1;
@@ -1249,7 +1258,7 @@
 	/* Apply connection information to the RTP instance */
 	ast_sockaddr_set_port(addrs, remote_stream->desc.port);
 	ast_rtp_instance_set_remote_address(session_media->rtp, addrs);
-	if (set_caps(session, session_media, remote_stream)) {
+	if (set_caps(session, session_media, remote_stream, 0)) {
 		return 1;
 	}
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I97ecebc1ab9b5654fb918bf1f4c98c956b852369
Gerrit-PatchSet: 3
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list