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

FreeSWITCH SVN brian at freeswitch.org
Thu May 28 19:08:25 PDT 2009


Author: brian
Date: Thu May 28 21:08:24 2009
New Revision: 13502

Log:
FSRTP-2 with mods

Modified:
   freeswitch/trunk/src/switch_core_sqldb.c
   freeswitch/trunk/src/switch_rtp.c

Modified: freeswitch/trunk/src/switch_core_sqldb.c
==============================================================================
--- freeswitch/trunk/src/switch_core_sqldb.c	(original)
+++ freeswitch/trunk/src/switch_core_sqldb.c	Thu May 28 21:08:24 2009
@@ -387,6 +387,18 @@
 			}
 			break;
 		}
+	case SWITCH_EVENT_CALL_SECURE:
+		{
+			const char *type = switch_event_get_header_nil(event, "secure_type");
+			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Secure Type: %s\n", type);
+			if (switch_strlen_zero(type)) {
+				break;
+			}
+			sql = switch_mprintf("update channels set secure='%s' where uuid='%s'",
+								 type,
+								 switch_event_get_header_nil(event, "caller-unique-id"));
+			break;
+		}
 	default:
 		break;
 	}
@@ -454,7 +466,8 @@
 			"   read_codec  VARCHAR(255),\n" 
 			"   read_rate  VARCHAR(255),\n" 
 			"   write_codec  VARCHAR(255),\n" 
-			"   write_rate  VARCHAR(255)\n" 
+			"   write_rate  VARCHAR(255),\n" 
+			"   secure VARCHAR(255)\n"
 			");\ncreate index uuindex on channels (uuid);\n";
 		char create_calls_sql[] =
 			"CREATE TABLE calls (\n"

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Thu May 28 21:08:24 2009
@@ -437,6 +437,7 @@
 	switch_rtp_t *rtp_session = zrtp_stream_get_userdata(stream);
 	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
 	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_event_t *fsevent = NULL;
 	
 	zrtp_session_info_t zrtp_session_info;
 
@@ -460,6 +461,12 @@
 				}
 			}
 		}
+		if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
+			switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "zrtp:%s:%s",
+									rtp_session->zrtp_session->sas1.buffer, rtp_session->zrtp_session->sas2.buffer);
+			switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
+			switch_event_fire(&fsevent);
+		}
 		break;
 
 	case ZRTP_EVENT_IS_CLIENT_ENROLLMENT:
@@ -909,6 +916,9 @@
 	srtp_policy_t *policy;
 	err_status_t stat;
 	switch_status_t status = SWITCH_STATUS_SUCCESS;
+	switch_core_session_t *session = switch_core_memory_pool_get_data(rtp_session->pool, "__session");
+	switch_channel_t *channel = switch_core_session_get_channel(session);
+	switch_event_t *fsevent = NULL;
 
 	if (direction >= SWITCH_RTP_CRYPTO_MAX || keylen > SWITCH_RTP_MAX_CRYPTO_LEN) {
 		return SWITCH_STATUS_FALSE;
@@ -996,6 +1006,13 @@
 		break;
 	}
 
+	if (switch_event_create(&fsevent, SWITCH_EVENT_CALL_SECURE) == SWITCH_STATUS_SUCCESS) {
+		switch_event_add_header(fsevent, SWITCH_STACK_BOTTOM, "secure_type", "srtp:%s", switch_channel_get_variable(channel, "sip_has_crypto"));
+		switch_event_add_header_string(fsevent, SWITCH_STACK_BOTTOM, "caller-unique-id", switch_channel_get_uuid(channel));
+		switch_event_fire(&fsevent);
+	}
+
+
 	return SWITCH_STATUS_SUCCESS;
 }
 



More information about the Freeswitch-svn mailing list