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

Joshua Elson asteriskteam at digium.com
Fri Jan 6 21:13:17 CST 2017


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

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/02/4702/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 8afa75d..e07b5e0 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -597,6 +597,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)
 {
@@ -635,6 +655,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/4702
To unsubscribe, visit https://gerrit.asterisk.org/settings

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



More information about the asterisk-code-review mailing list