[Asterisk-code-review] res pjsip sdp rtp: Fix issue with optimistic encryption & DTLS (asterisk[13])

Joshua Elson asteriskteam at digium.com
Fri Jan 6 21:12:07 CST 2017


Joshua Elson has uploaded a new change for review. ( https://gerrit.asterisk.org/4701 )

Change subject: res_pjsip_sdp_rtp: Fix issue with optimistic encryption & DTLS
......................................................................

res_pjsip_sdp_rtp: Fix issue with optimistic encryption & DTLS

Adds ability to detect DTLS fingerprint, in addition to just
detecting crypto line for SDES when optimistic encryption used

ASTERISK-26701 #close

Change-Id: I880a2cf4611012babe316146d8ce25e77b62e8f2
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 23 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/01/4701/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index b27050e..5d77a2b 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -587,6 +587,26 @@
 	ice->start(session_media->rtp);
 }
 
+/*! \brief figure out if media stream has fingerprint line for dtls */
+static int media_stream_has_fingerprint(const struct pjmedia_sdp_media *stream)
+{
+        int i;
+
+        for (i = 0; i < stream->attr_count; i++) {
+                pjmedia_sdp_attr *attr;
+
+                /* check the stream for the required fingerprint attribute */
+                attr = stream->attr[i];
+                if (pj_strcmp2(&attr->name, "fingerprint")) {
+                        continue;
+                }
+
+                return 1;
+        }
+
+        return 0;
+}
+
 /*! \brief figure out if media stream has crypto lines for sdes */
 static int media_stream_has_crypto(const struct pjmedia_sdp_media *stream)
 {
@@ -625,6 +645,9 @@
 	} else if (media_stream_has_crypto(stream)) {
 		*optimistic = 1;
 		return AST_SIP_MEDIA_ENCRYPT_SDES;
+	} else if (media_stream_has_fingerprint(stream)) {
+		*optimistic = 1;
+		return AST_SIP_MEDIA_ENCRYPT_DTLS;
 	} else {
 		return AST_SIP_MEDIA_ENCRYPT_NONE;
 	}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I880a2cf4611012babe316146d8ce25e77b62e8f2
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Joshua Elson <joshelson at gmail.com>



More information about the asterisk-code-review mailing list