提交 5646957c authored 作者: Anthony Minessale's avatar Anthony Minessale

FS-5937

上级 514bbd38
...@@ -39,17 +39,6 @@ SWITCH_BEGIN_EXTERN_C ...@@ -39,17 +39,6 @@ SWITCH_BEGIN_EXTERN_C
#define SWITCH_MAX_CAND_ACL 25 #define SWITCH_MAX_CAND_ACL 25
typedef enum {
SDP_TYPE_REQUEST,
SDP_TYPE_RESPONSE
} switch_sdp_type_t;
typedef enum {
ICE_GOOGLE_JINGLE = (1 << 0),
ICE_VANILLA = (1 << 1),
ICE_CONTROLLED = (1 << 2)
} switch_core_media_ice_type_t;
typedef enum { typedef enum {
DTMF_2833, DTMF_2833,
DTMF_INFO, DTMF_INFO,
...@@ -157,41 +146,6 @@ typedef struct switch_core_media_params_s { ...@@ -157,41 +146,6 @@ typedef struct switch_core_media_params_s {
} switch_core_media_params_t; } switch_core_media_params_t;
typedef struct payload_map_s {
switch_media_type_t type;
switch_sdp_type_t sdp_type;
uint32_t ptime;
uint32_t rate;
uint8_t allocated;
uint8_t negotiated;
uint8_t current;
unsigned long hash;
char *rm_encoding;
char *iananame;
switch_payload_t pt;
unsigned long rm_rate;
unsigned long adv_rm_rate;
uint32_t codec_ms;
uint32_t bitrate;
char *rm_fmtp;
switch_payload_t agreed_pt;
switch_payload_t recv_pt;
char *fmtp_out;
char *remote_sdp_ip;
switch_port_t remote_sdp_port;
int channels;
int adv_channels;
struct payload_map_s *next;
} payload_map_t;
static inline const char *switch_media_type2str(switch_media_type_t type) static inline const char *switch_media_type2str(switch_media_type_t type)
{ {
switch(type) { switch(type) {
...@@ -311,6 +265,12 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se ...@@ -311,6 +265,12 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
uint32_t ptime, uint32_t ptime,
uint8_t negotiated); uint8_t negotiated);
SWITCH_DECLARE(switch_rtp_crypto_key_type_t) switch_core_media_crypto_str2type(const char *str);
SWITCH_DECLARE(const char *) switch_core_media_crypto_type2str(switch_rtp_crypto_key_type_t type);
SWITCH_DECLARE(int) switch_core_media_crypto_keylen(switch_rtp_crypto_key_type_t type);
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C
#endif #endif
/* For Emacs: /* For Emacs:
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#define SWITCH_FRAME_H #define SWITCH_FRAME_H
#include <switch.h> #include <switch.h>
#include <switch_core_media.h>
SWITCH_BEGIN_EXTERN_C SWITCH_BEGIN_EXTERN_C
/*! \brief An abstraction of a data frame */ /*! \brief An abstraction of a data frame */
......
...@@ -41,18 +41,16 @@ ...@@ -41,18 +41,16 @@
SWITCH_BEGIN_EXTERN_C SWITCH_BEGIN_EXTERN_C
#include <switch_core_media.h>
#define SWITCH_RTP_MAX_BUF_LEN 16384 #define SWITCH_RTP_MAX_BUF_LEN 16384
#define SWITCH_RTCP_MAX_BUF_LEN 16384 #define SWITCH_RTCP_MAX_BUF_LEN 16384
#define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */ #define SWITCH_RTP_MAX_BUF_LEN_WORDS 4094 /* (max / 4) - 2 */
#define SWITCH_RTP_MAX_CRYPTO_LEN 64 #define SWITCH_RTP_MAX_CRYPTO_LEN 64
#define SWITCH_RTP_KEY_LEN 30 //#define SWITCH_RTP_KEY_LEN 30
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32" //#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80" #define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
#define SWITCH_RTP_CRYPTO_KEY_128_8 "AEAD_AES_128_GCM_8"
#define SWITCH_RTP_CRYPTO_KEY_256_8 "AEAD_AES_256_GCM_8"
typedef enum { typedef enum {
SWITCH_RTP_CRYPTO_SEND, SWITCH_RTP_CRYPTO_SEND,
SWITCH_RTP_CRYPTO_RECV, SWITCH_RTP_CRYPTO_RECV,
SWITCH_RTP_CRYPTO_SEND_RTCP, SWITCH_RTP_CRYPTO_SEND_RTCP,
...@@ -60,16 +58,12 @@ SWITCH_BEGIN_EXTERN_C ...@@ -60,16 +58,12 @@ SWITCH_BEGIN_EXTERN_C
SWITCH_RTP_CRYPTO_MAX SWITCH_RTP_CRYPTO_MAX
} switch_rtp_crypto_direction_t; } switch_rtp_crypto_direction_t;
typedef enum { typedef struct switch_srtp_crypto_suite_s {
NO_CRYPTO, char *name;
AES_CM_128_HMAC_SHA1_80, switch_rtp_crypto_key_type_t type;
AES_CM_128_HMAC_SHA1_32, int keylen;
AES_CM_256_HMAC_SHA1_80, } switch_srtp_crypto_suite_t;
AES_CM_192_HMAC_SHA1_80,
AEAD_AES_256_GCM_8,
AEAD_AES_128_GCM_8,
AES_CM_128_NULL_AUTH
} switch_rtp_crypto_key_type_t;
struct switch_rtp_crypto_key { struct switch_rtp_crypto_key {
uint32_t index; uint32_t index;
......
...@@ -2312,6 +2312,67 @@ typedef void (*switch_event_channel_func_t)(const char *event_channel, cJSON *js ...@@ -2312,6 +2312,67 @@ typedef void (*switch_event_channel_func_t)(const char *event_channel, cJSON *js
struct switch_live_array_s; struct switch_live_array_s;
typedef struct switch_live_array_s switch_live_array_t; typedef struct switch_live_array_s switch_live_array_t;
typedef enum {
SDP_TYPE_REQUEST,
SDP_TYPE_RESPONSE
} switch_sdp_type_t;
typedef enum {
AEAD_AES_256_GCM_8,
AEAD_AES_128_GCM_8,
AES_CM_256_HMAC_SHA1_80,
AES_CM_192_HMAC_SHA1_80,
AES_CM_128_HMAC_SHA1_80,
AES_CM_256_HMAC_SHA1_32,
AES_CM_192_HMAC_SHA1_32,
AES_CM_128_HMAC_SHA1_32,
AES_CM_128_NULL_AUTH,
NO_CRYPTO,
CRYPTO_INVALID
} switch_rtp_crypto_key_type_t;
typedef struct payload_map_s {
switch_media_type_t type;
switch_sdp_type_t sdp_type;
uint32_t ptime;
uint32_t rate;
uint8_t allocated;
uint8_t negotiated;
uint8_t current;
unsigned long hash;
char *rm_encoding;
char *iananame;
switch_payload_t pt;
unsigned long rm_rate;
unsigned long adv_rm_rate;
uint32_t codec_ms;
uint32_t bitrate;
char *rm_fmtp;
switch_payload_t agreed_pt;
switch_payload_t recv_pt;
char *fmtp_out;
char *remote_sdp_ip;
switch_port_t remote_sdp_port;
int channels;
int adv_channels;
struct payload_map_s *next;
} payload_map_t;
typedef enum {
ICE_GOOGLE_JINGLE = (1 << 0),
ICE_VANILLA = (1 << 1),
ICE_CONTROLLED = (1 << 2)
} switch_core_media_ice_type_t;
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C
......
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
#include <switch_stun.h> #include <switch_stun.h>
#include <libdingaling.h> #include <libdingaling.h>
#define SWITCH_RTP_KEY_LEN 30
#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32"
#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80"
#define MDL_RTCP_DUR 5000 #define MDL_RTCP_DUR 5000
#define DL_CAND_WAIT 10000000 #define DL_CAND_WAIT 10000000
#define DL_CAND_INITIAL_WAIT 2000000 #define DL_CAND_INITIAL_WAIT 2000000
......
...@@ -1220,7 +1220,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi ...@@ -1220,7 +1220,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
if (((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) || if (((var = switch_channel_get_variable(channel, SOFIA_SECURE_MEDIA_VARIABLE)) ||
(var = switch_channel_get_variable(channel, "rtp_secure_media"))) && (var = switch_channel_get_variable(channel, "rtp_secure_media"))) &&
(switch_true(var) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_32) || !strcasecmp(var, SWITCH_RTP_CRYPTO_KEY_80))) { (switch_true(var) || switch_core_media_crypto_str2type(var) != CRYPTO_INVALID)) {
switch_channel_set_flag(tech_pvt->channel, CF_SECURE); switch_channel_set_flag(tech_pvt->channel, CF_SECURE);
} }
......
...@@ -3331,21 +3331,6 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel) ...@@ -3331,21 +3331,6 @@ SWITCH_DECLARE(void) switch_channel_check_zrtp(switch_channel_t *channel)
} }
} }
static void check_secure(switch_channel_t *channel)
{
const char *var, *sec;
if (!switch_channel_media_ready(channel) && switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
if ((sec = switch_channel_get_variable(channel, "rtp_secure_media")) && switch_true(sec)) {
if (!(var = switch_channel_get_variable(channel, "rtp_has_crypto"))) {
switch_log_printf(SWITCH_CHANNEL_CHANNEL_LOG(channel), SWITCH_LOG_WARNING, "rtp_secure_media invalid in this context.\n");
switch_channel_set_variable(channel, "rtp_secure_media", NULL);
}
}
}
}
SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line) SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_channel_t *channel, const char *file, const char *func, int line)
{ {
switch_event_t *event; switch_event_t *event;
...@@ -3433,8 +3418,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel ...@@ -3433,8 +3418,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_pre_answer(switch_channel
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
check_secure(channel);
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) { if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS; msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
msg.from = channel->name; msg.from = channel->name;
...@@ -3720,8 +3703,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t * ...@@ -3720,8 +3703,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_answer(switch_channel_t *
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
check_secure(channel);
msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER; msg.message_id = SWITCH_MESSAGE_INDICATE_ANSWER;
msg.from = channel->name; msg.from = channel->name;
status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line); status = switch_core_session_perform_receive_message(channel->session, &msg, file, func, line);
......
差异被折叠。
...@@ -2731,7 +2731,6 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls) ...@@ -2731,7 +2731,6 @@ static int do_dtls(switch_rtp_t *rtp_session, switch_dtls_t *dtls)
if (!dtls->bytes && !ready) { if (!dtls->bytes && !ready) {
printf("SKIP\n");
return 0; return 0;
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论