[Freeswitch-svn] [commit] r13422 - freeswitch/trunk/src

FreeSWITCH SVN mikej at freeswitch.org
Thu May 21 15:37:15 PDT 2009


Author: mikej
Date: Thu May 21 17:37:15 2009
New Revision: 13422

Log:
 allow switching from secure to clear and back now 

Modified:
   freeswitch/trunk/src/switch_rtp.c

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Thu May 21 17:37:15 2009
@@ -418,14 +418,11 @@
 {
 	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
 	zrtp_session_info_t zrtp_session_info;
+	zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info);
 
 	switch (event) {
-	case ZRTP_EVENT_IS_SECURE:
-		zrtp_session_get(rtp_session->zrtp_session, &zrtp_session_info);
-		zrtp_log_print_sessioninfo(&zrtp_session_info);
-
-		break;
 	default:
+		zrtp_log_print_sessioninfo(&zrtp_session_info);
 		break;
 	}
 }
@@ -452,11 +449,19 @@
 		switch_set_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
 		break;
 	case ZRTP_EVENT_IS_CLIENT_ENROLLMENT:
+		break;
 	case ZRTP_EVENT_IS_CLEAR:
+		break;
 	case ZRTP_EVENT_IS_INITIATINGSECURE:
+		break;
 	case ZRTP_EVENT_IS_PENDINGSECURE:
+		break;
 	case ZRTP_EVENT_IS_PENDINGCLEAR:
+		switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_SEND);
+		switch_clear_flag(rtp_session, SWITCH_ZRTP_FLAG_SECURE_RECV);
+		break;
 	case ZRTP_EVENT_NO_ZRTP:
+		break;
 	case ZRTP_EVENT_LOCAL_SAS_UPDATED:
 		break;
 	default:
@@ -1038,12 +1043,12 @@
 		switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_NOBLOCK);
 	}
 
-	rtp_session->ready = 1;
-	*new_rtp_session = rtp_session;
 #ifdef ENABLE_ZRTP
 	if (zrtp_on) {
 		rtp_session->zrtp_profile = switch_core_alloc(rtp_session->pool, sizeof(*rtp_session->zrtp_profile));
 		zrtp_profile_defaults(rtp_session->zrtp_profile, zrtp_global);
+
+		rtp_session->zrtp_profile->allowclear = 1;
 	
 		if (zrtp_status_ok != zrtp_session_init(zrtp_global, rtp_session->zrtp_profile, zid, 1, &rtp_session->zrtp_session)) {
 			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error! zRTP INIT Failed\n");
@@ -1062,6 +1067,9 @@
 	}
 #endif	
 
+	rtp_session->ready = 1;
+	*new_rtp_session = rtp_session;
+
 	return SWITCH_STATUS_SUCCESS;
 }
 
@@ -1851,6 +1859,7 @@
 				break;
 			case zrtp_status_drop:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				break;
 			case zrtp_status_fail:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
 				ret = -1;
@@ -2440,8 +2449,10 @@
 				break;
 			case zrtp_status_drop:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				break;
 			case zrtp_status_fail:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+				break;
 			default:
 				break;
 			}
@@ -2704,8 +2715,10 @@
 				break;
 			case zrtp_status_drop:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+				break;
 			case zrtp_status_fail:
 				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+				break;
 			default:
 				break;
 			}



More information about the Freeswitch-svn mailing list