zrtp_config.is_mitm = 1;
zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE;
switch_snprintf(zrtp_cache_path, sizeof(zrtp_cache_path), "%s%szrtp.dat", SWITCH_GLOBAL_dirs.db_dir, SWITCH_PATH_SEPARATOR);
- zrtp_zstrcpyc(ZSTR_GV(zrtp_config.def_cache_path), zrtp_cache_path);
+ zrtp_zstrcpyc((zrtp_stringn_t*)zrtp_config.def_cache_path.buffer, zrtp_cache_path);
+ zrtp_config.def_cache_path.length = strlen(zrtp_cache_path);
+ zrtp_config.def_cache_path.max_length = 255;
zrtp_config.cb.event_cb.on_zrtp_protocol_event = zrtp_event_callback;
zrtp_config.cb.misc_cb.on_send_packet = zrtp_send_rtp_callback;
zrtp_config.cb.event_cb.on_zrtp_security_event = zrtp_event_callback;
}
#ifdef ENABLE_ZRTP
- if (zrtp_on) {
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
switch_rtp_t *master_rtp_session = NULL;
int initiator = 0;
#ifdef ENABLE_ZRTP
/* ZRTP */
- if (zrtp_on) {
+ if (zrtp_on && !switch_test_flag((*rtp_session), SWITCH_RTP_FLAG_PROXY_MEDIA)) {
if ((*rtp_session)->zrtp_stream != NULL) {
zrtp_stream_stop((*rtp_session)->zrtp_stream);
if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) {
#ifdef ENABLE_ZRTP
/* ZRTP Recv */
-
- unsigned int sbytes = (int) *bytes;
- zrtp_status_t stat = 0;
-
- stat = zrtp_process_srtp(rtp_session->zrtp_stream, (void *) &rtp_session->recv_msg, &sbytes);
-
- switch (stat) {
- case zrtp_status_ok:
- *bytes = sbytes;
- break;
- case zrtp_status_drop:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
- *bytes = 0;
- return SWITCH_STATUS_SUCCESS;
- case zrtp_status_fail:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
- return SWITCH_STATUS_FALSE;
- default:
- break;
+ if(zrtp_on) {
+
+ unsigned int sbytes = (int) *bytes;
+ zrtp_status_t stat = 0;
+
+ stat = zrtp_process_srtp(rtp_session->zrtp_stream, (void *) &rtp_session->recv_msg, &sbytes);
+
+ switch (stat) {
+ case zrtp_status_ok:
+ *bytes = sbytes;
+ break;
+ case zrtp_status_drop:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+ *bytes = 0;
+ return SWITCH_STATUS_SUCCESS;
+ case zrtp_status_fail:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+ return SWITCH_STATUS_FALSE;
+ default:
+ break;
+ }
}
#endif
#ifdef ENABLE_ZRTP
- /* ZRTP Recv */
- if (bytes) {
- unsigned int sbytes = (int) *bytes;
- zrtp_status_t stat = 0;
-
- stat = zrtp_process_srtcp(rtp_session->zrtp_stream, (void *) &rtp_session->rtcp_recv_msg, &sbytes);
-
- switch (stat) {
- case zrtp_status_ok:
- *bytes = sbytes;
- break;
- case zrtp_status_drop:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
- *bytes = 0;
- break;
- case zrtp_status_fail:
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
- *bytes = 0;
- break;
- default:
- break;
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
+ /* ZRTP Recv */
+ if (bytes) {
+ unsigned int sbytes = (int) *bytes;
+ zrtp_status_t stat = 0;
+
+ stat = zrtp_process_srtcp(rtp_session->zrtp_stream, (void *) &rtp_session->rtcp_recv_msg, &sbytes);
+
+ switch (stat) {
+ case zrtp_status_ok:
+ *bytes = sbytes;
+ break;
+ case zrtp_status_drop:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat);
+ *bytes = 0;
+ break;
+ case zrtp_status_fail:
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat);
+ *bytes = 0;
+ break;
+ default:
+ break;
+ }
}
}
#endif
#ifdef ENABLE_ZRTP
/* ZRTP Send */
- if (1) {
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail;
-
+
stat = zrtp_process_rtcp(other_rtp_session->zrtp_stream, (void *) &other_rtp_session->rtcp_send_msg, &sbytes);
-
+
switch (stat) {
case zrtp_status_ok:
break;
default:
break;
}
-
+
bytes = sbytes;
}
#endif
#endif
#ifdef ENABLE_ZRTP
/* ZRTP Send */
- if (1) {
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail;
#ifdef ENABLE_ZRTP
/* ZRTP Send */
- if (1) {
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail;
#endif
#ifdef ENABLE_ZRTP
/* ZRTP Send */
- if (1) {
+ if (zrtp_on && !switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA)) {
unsigned int sbytes = (int) bytes;
zrtp_status_t stat = zrtp_status_fail;