mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-25 12:10:18 +00:00
FS-5755
rtp_secure_media=mandatory rtp_secure_media=optional rtp_secure_media=mandatory:AES_CM_256_HMAC_SHA1_80,AES_CM_256_HMAC_SHA1_32 rtp_secure_media=optional:AES_CM_256_HMAC_SHA1_80 rtp_secure_media=forbidden true implies mandatory false implies forbidden not set implies optional rtp_secure_media_inbound or rtp_secure_media_outbound take precedence and are treated the same way based on leg direction
This commit is contained in:
parent
eba0cb5f0f
commit
e5b291514c
@ -169,7 +169,7 @@ SWITCH_DECLARE(void) switch_media_handle_set_media_flag(switch_media_handle_t *s
|
|||||||
SWITCH_DECLARE(void) switch_media_handle_clear_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag);
|
SWITCH_DECLARE(void) switch_media_handle_clear_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag);
|
||||||
SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag);
|
SWITCH_DECLARE(int32_t) switch_media_handle_test_media_flag(switch_media_handle_t *smh, switch_core_media_flag_t flag);
|
||||||
SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]);
|
SWITCH_DECLARE(void) switch_media_handle_set_media_flags(switch_media_handle_t *smh, switch_core_media_flag_t flags[]);
|
||||||
SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_session_t *session, const char *sec_var);
|
SWITCH_DECLARE(void) switch_core_session_check_outgoing_crypto(switch_core_session_t *session);
|
||||||
SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type);
|
SWITCH_DECLARE(const char *) switch_core_session_local_crypto_key(switch_core_session_t *session, switch_media_type_t type);
|
||||||
SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session,
|
SWITCH_DECLARE(int) switch_core_session_check_incoming_crypto(switch_core_session_t *session,
|
||||||
const char *varname,
|
const char *varname,
|
||||||
|
@ -1223,13 +1223,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
|
sofia_glue_execute_sql_now(tech_pvt->profile, &sql, SWITCH_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) ||
|
|
||||||
(var = switch_channel_get_variable(channel, "rtp_secure_media"))) &&
|
|
||||||
(switch_true(var) || switch_core_media_crypto_str2type(var) != CRYPTO_INVALID)) {
|
|
||||||
switch_channel_set_flag(tech_pvt->channel, CF_SECURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING)) {
|
if (sofia_test_media_flag(tech_pvt->profile, SCMF_AUTOFIX_TIMING)) {
|
||||||
switch_core_media_reset_autofix(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
|
switch_core_media_reset_autofix(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO);
|
||||||
}
|
}
|
||||||
@ -1252,18 +1245,18 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||||||
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
case SWITCH_MESSAGE_INDICATE_VIDEO_REFRESH_REQ:
|
||||||
{
|
{
|
||||||
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
|
const char *pl = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<media_control>\n<vc_primitive>\n<to_encoder>\n<picture_fast_update>\n</picture_fast_update>\n</to_encoder>\n</vc_primitive>\n</media_control>";
|
||||||
//time_t now = switch_epoch_time_now(NULL);
|
time_t now = switch_epoch_time_now(NULL);
|
||||||
|
|
||||||
//if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 5) {
|
if (!tech_pvt->last_vid_info || (now - tech_pvt->last_vid_info) > 1) {
|
||||||
|
|
||||||
// tech_pvt->last_vid_info = now;
|
tech_pvt->last_vid_info = now;
|
||||||
|
|
||||||
if (!zstr(msg->string_arg)) {
|
if (!zstr(msg->string_arg)) {
|
||||||
pl = msg->string_arg;
|
pl = msg->string_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("application/media_control+xml"), SIPTAG_PAYLOAD_STR(pl), TAG_END());
|
||||||
//}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -4349,18 +4342,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session
|
|||||||
tech_pvt->dest_to = tech_pvt->dest;
|
tech_pvt->dest_to = tech_pvt->dest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((hval = switch_event_get_header(var_event, "media_webrtc")) && switch_true(hval)) {
|
|
||||||
switch_channel_set_variable(nchannel, "rtp_secure_media", SWITCH_RTP_CRYPTO_KEY_80);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((hval = switch_event_get_header(var_event, SOFIA_SECURE_MEDIA_VARIABLE)) ||
|
|
||||||
(hval = switch_event_get_header(var_event, "rtp_secure_media"))) {
|
|
||||||
|
|
||||||
switch_channel_set_variable(nchannel, "rtp_secure_media", hval);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!zstr(tech_pvt->dest) && switch_stristr("transport=ws", tech_pvt->dest)) {
|
if (!zstr(tech_pvt->dest) && switch_stristr("transport=ws", tech_pvt->dest)) {
|
||||||
switch_channel_set_variable(nchannel, "rtp_secure_media", SWITCH_RTP_CRYPTO_KEY_80);
|
|
||||||
switch_channel_set_variable(nchannel, "media_webrtc", "true");
|
switch_channel_set_variable(nchannel, "media_webrtc", "true");
|
||||||
switch_core_session_set_ice(nsession);
|
switch_core_session_set_ice(nsession);
|
||||||
}
|
}
|
||||||
|
@ -111,9 +111,6 @@ typedef struct private_object private_object_t;
|
|||||||
#define SOFIA_DEFAULT_PORT "5060"
|
#define SOFIA_DEFAULT_PORT "5060"
|
||||||
#define SOFIA_DEFAULT_TLS_PORT "5061"
|
#define SOFIA_DEFAULT_TLS_PORT "5061"
|
||||||
#define SOFIA_REFER_TO_VARIABLE "sip_refer_to"
|
#define SOFIA_REFER_TO_VARIABLE "sip_refer_to"
|
||||||
#define SOFIA_SECURE_MEDIA_VARIABLE "rtp_secure_media"
|
|
||||||
#define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "rtp_secure_media_confirmed"
|
|
||||||
#define SOFIA_SECURE_VIDEO_CONFIRMED_VARIABLE "sip_secure_video_confirmed"
|
|
||||||
//#define SOFIA_HAS_CRYPTO_VARIABLE "rtp_has_crypto"
|
//#define SOFIA_HAS_CRYPTO_VARIABLE "rtp_has_crypto"
|
||||||
//#define SOFIA_HAS_VIDEO_CRYPTO_VARIABLE "sip_has_video_crypto"
|
//#define SOFIA_HAS_VIDEO_CRYPTO_VARIABLE "sip_has_video_crypto"
|
||||||
//#define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
|
//#define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3092,6 +3092,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess
|
|||||||
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
|
||||||
switch_channel_set_variable(channel, "rtp_has_crypto", "AES_CM_256_HMAC_SHA1_80");
|
switch_channel_set_variable(channel, "rtp_has_crypto", "AES_CM_256_HMAC_SHA1_80");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case AES_CM_128_NULL_AUTH:
|
case AES_CM_128_NULL_AUTH:
|
||||||
crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
|
crypto_policy_set_aes_cm_128_null_auth(&policy->rtp);
|
||||||
crypto_policy_set_aes_cm_128_null_auth(&policy->rtcp);
|
crypto_policy_set_aes_cm_128_null_auth(&policy->rtcp);
|
||||||
@ -3355,9 +3356,9 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_create(switch_rtp_t **new_rtp_session
|
|||||||
|
|
||||||
int initiator = 0;
|
int initiator = 0;
|
||||||
const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
|
const char *zrtp_enabled = switch_channel_get_variable(channel, "zrtp_secure_media");
|
||||||
const char *srtp_enabled = switch_channel_get_variable(channel, "rtp_secure_media");
|
int srtp_enabled = switch_channel_test_flag(channel, CF_SECURE);
|
||||||
|
|
||||||
if (switch_true(srtp_enabled) && switch_true(zrtp_enabled)) {
|
if (srtp_enabled && switch_true(zrtp_enabled)) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
|
||||||
"You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n");
|
"You can not have ZRTP and SRTP enabled simultaneously, ZRTP will be disabled for this call!\n");
|
||||||
switch_channel_set_variable(channel, "zrtp_secure_media", NULL);
|
switch_channel_set_variable(channel, "zrtp_secure_media", NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user