[Freeswitch-svn] [commit] r8908 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Mon Jul 7 13:56:16 EDT 2008


Author: mikej
Date: Mon Jul  7 13:56:16 2008
New Revision: 8908

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

Log:
add flags to turn off srtp auth and rtp auto adj (FSCORE-149 && MODENDP-115)

Modified: freeswitch/trunk/src/include/switch_rtp.h
==============================================================================
--- freeswitch/trunk/src/include/switch_rtp.h	(original)
+++ freeswitch/trunk/src/include/switch_rtp.h	Mon Jul  7 13:56:16 2008
@@ -53,8 +53,9 @@
 
 typedef enum {
 	NO_CRYPTO,
-	AES_CM_128_HMAC_SHA1_80,
-	AES_CM_128_HMAC_SHA1_32
+	AES_CM_128_HMAC_SHA1_80, 
+	AES_CM_128_HMAC_SHA1_32,
+	AES_CM_128_NULL_AUTH
 } switch_rtp_crypto_key_type_t;
 
 struct switch_rtp_crypto_key {

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	Mon Jul  7 13:56:16 2008
@@ -154,7 +154,9 @@
 	PFLAG_DISABLE_100REL = (1 << 20),
 	PFLAG_AGGRESSIVE_NAT_DETECTION = (1 << 21),
 	PFLAG_RECIEVED_IN_NAT_REG_CONTACT = (1 << 22),
-	PFLAG_3PCC = (1 << 23)
+	PFLAG_3PCC = (1 << 23),
+	PFLAG_DISABLE_RTP_AUTOADJ = (1 << 24),
+	PFLAG_DISABLE_SRTP_AUTH = (1 << 25)
 } PFLAGS;
 
 typedef enum {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Mon Jul  7 13:56:16 2008
@@ -1103,6 +1103,10 @@
 						profile->pflags |= PFLAG_RECIEVED_IN_NAT_REG_CONTACT;
 					} else if (!strcasecmp(var, "aggressive-nat-detection") && switch_true(val)) {
 						profile->pflags |= PFLAG_AGGRESSIVE_NAT_DETECTION;
+					} else if (!strcasecmp(var, "disable-rtp-auto-adjust") && switch_true(val)) {
+						profile->pflags |= PFLAG_DISABLE_RTP_AUTOADJ;
+					} else if (!strcasecmp(var, "NDLB-support-asterisk-missing-srtp-auth") && switch_true(val)) {
+						profile->pflags |= PFLAG_DISABLE_SRTP_AUTH;
 					} else if (!strcasecmp(var, "rfc2833-pt")) {
 						profile->te = (switch_payload_t) atoi(val);
 					} else if (!strcasecmp(var, "cng-pt")) {

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	Mon Jul  7 13:56:16 2008
@@ -727,6 +727,7 @@
 	char rvp[128] = "";
 	char *p, *ip_ptr = NULL, *port_ptr = NULL, *vid_port_ptr = NULL;
 	int x;
+	const char *val;
 
 	if (switch_strlen_zero(tech_pvt->remote_sdp_str)) {
 		return SWITCH_STATUS_FALSE;
@@ -795,8 +796,11 @@
 				} else {
 					switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "VIDEO RTP CHANGING DEST TO: [%s:%d]\n",
 									  tech_pvt->remote_sdp_video_ip, tech_pvt->remote_sdp_video_port);
-					/* Reactivate the NAT buster flag. */
-					switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+					if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+						!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+						/* Reactivate the NAT buster flag. */
+						switch_rtp_set_flag(tech_pvt->video_rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+					}
 				}
 			}
 		}
@@ -815,8 +819,11 @@
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
-			/* Reactivate the NAT buster flag. */
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				/* Reactivate the NAT buster flag. */
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);	
+			}
 		}
 	}
 
@@ -1473,6 +1480,7 @@
 	unsigned char b64_key[512] = "";
 	const char *type_str;
 	unsigned char *key;
+	const char *val;
 
 	char *p;
 
@@ -1499,8 +1507,13 @@
 
 	tech_pvt->local_crypto_key = switch_core_session_sprintf(tech_pvt->session, "%d %s inline:%s", index, type_str, b64_key);
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Local Key [%s]\n", tech_pvt->local_crypto_key);
-	tech_pvt->crypto_type = type;
 
+	if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_SRTP_AUTH) &&
+		!((val = switch_channel_get_variable(tech_pvt->channel, "NDLB_support_asterisk_missing_srtp_auth")) && switch_true(val))) {
+		tech_pvt->crypto_type = type;
+	} else {
+		tech_pvt->crypto_type = AES_CM_128_NULL_AUTH;
+	}
 
 	return SWITCH_STATUS_SUCCESS;
 }
@@ -1605,8 +1618,11 @@
 
 	if (myflags) {
 		flags = myflags;
-	} else {
+	} else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
 		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+    } else {
+		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_DATAWAIT);
 	}
 
 	if (switch_test_flag(tech_pvt, TFLAG_BUGGY_2833)) {
@@ -1669,8 +1685,11 @@
 		} else {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "AUDIO RTP CHANGING DEST TO: [%s:%d]\n",
 							  tech_pvt->remote_sdp_audio_ip, tech_pvt->remote_sdp_audio_port);
-			/* Reactivate the NAT buster flag. */
-			switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				/* Reactivate the NAT buster flag. */
+				switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			}
 		}
 		goto video;
 	}
@@ -1679,7 +1698,12 @@
 		if ((status = sofia_glue_tech_proxy_remote_addr(tech_pvt)) != SWITCH_STATUS_SUCCESS) {
 			goto end;
 		}
-		flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+		if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+			!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_AUTOADJ | SWITCH_RTP_FLAG_DATAWAIT);
+		} else {
+			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_PROXY_MEDIA | SWITCH_RTP_FLAG_DATAWAIT);
+		}
 		timer_name = NULL;
 
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "PROXY AUDIO RTP [%s] %s:%d->%s:%d codec: %u ms: %d\n",
@@ -1801,8 +1825,13 @@
 				sofia_glue_tech_choose_video_port(tech_pvt, 1);
 			}
 
-			flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
-										 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) &&
+				!((val = switch_channel_get_variable(tech_pvt->channel, "disable_rtp_auto_adjust")) && switch_true(val))) {
+				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_AUTOADJ |
+		 									 SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			} else {
+				flags = (switch_rtp_flag_t) (SWITCH_RTP_FLAG_USE_TIMER | SWITCH_RTP_FLAG_DATAWAIT | SWITCH_RTP_FLAG_NOBLOCK | SWITCH_RTP_FLAG_RAW_WRITE);
+			}
 
 			if (switch_channel_test_flag(tech_pvt->channel, CF_PROXY_MEDIA)) {
 				flags |= SWITCH_RTP_FLAG_PROXY_MEDIA;

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Mon Jul  7 13:56:16 2008
@@ -601,6 +601,9 @@
 	case AES_CM_128_HMAC_SHA1_32:
 		crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy->rtp);
 		break;
+	case AES_CM_128_NULL_AUTH:
+		crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
+		break;
 	default:
 		break;
 	}



More information about the Freeswitch-svn mailing list