[Freeswitch-svn] [commit] r7746 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Tue Feb 26 16:13:48 EST 2008


Author: anthm
Date: Tue Feb 26 16:13:47 2008
New Revision: 7746

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c

Log:
srtp update

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.h	Tue Feb 26 16:13:47 2008
@@ -76,6 +76,7 @@
 #define SOFIA_SECURE_MEDIA_VARIABLE "sip_secure_media"
 #define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "sip_secure_media_confirmed"
 #define SOFIA_HAS_CRYPTO_VARIABLE "sip_has_crypto"
+#define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
 
 #include <sofia-sip/nua.h>
 #include <sofia-sip/sip_status.h>

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c	Tue Feb 26 16:13:47 2008
@@ -1127,7 +1127,7 @@
 		if ((parser = sdp_parse(NULL, sdp_str, (int) strlen(sdp_str), 0))) {
 			if ((sdp = sdp_session(parser))) {
 				for (m = sdp->sdp_media; m; m = m->m_next) {
-					if (m->m_type != sdp_media_audio) {
+					if (m->m_type != sdp_media_audio || !m->m_port) {
 						continue;
 					}
 
@@ -1726,7 +1726,7 @@
 	switch_channel_t *channel = switch_core_session_get_channel(session);
 	const char *val;
 	const char *crypto = NULL;
-	int got_crypto = 0, got_audio = 0;
+	int got_crypto = 0, got_audio = 0, got_avp = 0, got_savp = 0;
 
 	switch_assert(tech_pvt != NULL);
 
@@ -1808,7 +1808,13 @@
 
 		ptime = dptime;
 
-		if (m->m_type == sdp_media_audio && !got_audio) {
+		if (m->m_proto == sdp_proto_srtp) {
+			got_savp++;
+		} else if (m->m_proto == sdp_proto_rtp) {
+			got_avp++;
+		}
+
+		if (m->m_type == sdp_media_audio && m->m_port && !got_audio) {
 			sdp_rtpmap_t *map;
 
 			for (attr = m->m_attributes; attr; attr = attr->a_next) {
@@ -1862,6 +1868,11 @@
 				}
 			}
 
+			if (got_crypto && !got_avp) {
+				switch_channel_set_variable(tech_pvt->channel, SOFIA_CRYPTO_MANDATORY_VARIABLE, "true");
+				switch_channel_set_variable(tech_pvt->channel, SOFIA_SECURE_MEDIA_VARIABLE, "true");
+			}
+
 			connection = sdp->sdp_connection;
 			if (m->m_connections) {
 				connection = m->m_connections;
@@ -2024,7 +2035,7 @@
 				goto greed;
 			}
 
-		} else if (m->m_type == sdp_media_video) { 
+		} else if (m->m_type == sdp_media_video && m->m_port) { 
 			sdp_rtpmap_t *map;
 			const char *rm_encoding;
 			int framerate = 0;



More information about the Freeswitch-svn mailing list