mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-13 07:45:26 +00:00
FSRTP-2 with mods
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13502 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
9dcc72422d
commit
05fc0e42eb
@ -387,6 +387,18 @@ static void core_event_handler(switch_event_t *event)
|
||||
}
|
||||
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 @@ void switch_core_sqldb_start(switch_memory_pool_t *pool)
|
||||
" 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"
|
||||
|
@ -437,6 +437,7 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
|
||||
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 @@ static void zrtp_event_callback(zrtp_stream_t *stream, unsigned event)
|
||||
}
|
||||
}
|
||||
}
|
||||
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 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
||||
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 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user