mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-15 05:08:26 +00:00
google changed something in DTLS
This commit is contained in:
parent
b474c89708
commit
b694cb09a6
@ -451,7 +451,8 @@ SWITCH_DECLARE(void) switch_live_array_unlock(switch_live_array_t *la);
|
|||||||
SWITCH_DECLARE(void) switch_live_array_set_user_data(switch_live_array_t *la, void *user_data);
|
SWITCH_DECLARE(void) switch_live_array_set_user_data(switch_live_array_t *la, void *user_data);
|
||||||
SWITCH_DECLARE(void) switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler);
|
SWITCH_DECLARE(void) switch_live_array_set_command_handler(switch_live_array_t *la, switch_live_array_command_handler_t command_handler);
|
||||||
SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id);
|
SWITCH_DECLARE(void) switch_live_array_parse_json(cJSON *json, switch_event_channel_id_t channel_id);
|
||||||
|
SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name);
|
||||||
|
SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name);
|
||||||
|
|
||||||
///\}
|
///\}
|
||||||
|
|
||||||
|
@ -97,6 +97,7 @@ static const EVP_MD *get_evp_by_name(const char *name)
|
|||||||
{
|
{
|
||||||
if (!strcasecmp(name, "md5")) return EVP_md5();
|
if (!strcasecmp(name, "md5")) return EVP_md5();
|
||||||
if (!strcasecmp(name, "sha1")) return EVP_sha1();
|
if (!strcasecmp(name, "sha1")) return EVP_sha1();
|
||||||
|
if (!strcasecmp(name, "sha-1")) return EVP_sha1();
|
||||||
if (!strcasecmp(name, "sha-256")) return EVP_sha256();
|
if (!strcasecmp(name, "sha-256")) return EVP_sha256();
|
||||||
if (!strcasecmp(name, "sha-512")) return EVP_sha512();
|
if (!strcasecmp(name, "sha-512")) return EVP_sha512();
|
||||||
|
|
||||||
|
@ -2038,7 +2038,11 @@ static void generate_local_fingerprint(switch_media_handle_t *smh, switch_media_
|
|||||||
switch_rtp_engine_t *engine = &smh->engines[type];
|
switch_rtp_engine_t *engine = &smh->engines[type];
|
||||||
|
|
||||||
if (!engine->local_dtls_fingerprint.len) {
|
if (!engine->local_dtls_fingerprint.len) {
|
||||||
engine->local_dtls_fingerprint.type = "sha-256";
|
if (engine->remote_dtls_fingerprint.type) {
|
||||||
|
engine->local_dtls_fingerprint.type = engine->remote_dtls_fingerprint.type;
|
||||||
|
} else {
|
||||||
|
engine->local_dtls_fingerprint.type = "sha-256";
|
||||||
|
}
|
||||||
switch_core_cert_gen_fingerprint(DTLS_SRTP_FNAME, &engine->local_dtls_fingerprint);
|
switch_core_cert_gen_fingerprint(DTLS_SRTP_FNAME, &engine->local_dtls_fingerprint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2118,16 +2122,16 @@ static void check_ice(switch_media_handle_t *smh, switch_media_type_t type, sdp_
|
|||||||
switch_set_string(engine->local_dtls_fingerprint.str, p);
|
switch_set_string(engine->local_dtls_fingerprint.str, p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcasecmp(engine->remote_dtls_fingerprint.type, "sha-256")) {
|
//if (strcasecmp(engine->remote_dtls_fingerprint.type, "sha-256")) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Unsupported fingerprint type.\n");
|
// switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(smh->session), SWITCH_LOG_WARNING, "Unsupported fingerprint type.\n");
|
||||||
engine->local_dtls_fingerprint.type = NULL;
|
//engine->local_dtls_fingerprint.type = NULL;
|
||||||
engine->remote_dtls_fingerprint.type = NULL;
|
//engine->remote_dtls_fingerprint.type = NULL;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
generate_local_fingerprint(smh, type);
|
generate_local_fingerprint(smh, type);
|
||||||
switch_channel_set_flag(smh->session->channel, CF_DTLS);
|
switch_channel_set_flag(smh->session->channel, CF_DTLS);
|
||||||
|
|
||||||
} else if (!engine->remote_ssrc && !strcasecmp(attr->a_name, "ssrc") && attr->a_value) {
|
} else if (!engine->remote_ssrc && !strcasecmp(attr->a_name, "ssrc") && attr->a_value) {
|
||||||
engine->remote_ssrc = (uint32_t) atol(attr->a_value);
|
engine->remote_ssrc = (uint32_t) atol(attr->a_value);
|
||||||
|
|
||||||
|
@ -2963,6 +2963,12 @@ SWITCH_DECLARE(switch_status_t) switch_event_channel_bind(const char *event_chan
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef struct alias_node_s {
|
||||||
|
char *event_channel;
|
||||||
|
char *name;
|
||||||
|
struct alias_node_s *next;
|
||||||
|
} alias_node_t;
|
||||||
|
|
||||||
typedef struct la_node_s {
|
typedef struct la_node_s {
|
||||||
char *name;
|
char *name;
|
||||||
cJSON *obj;
|
cJSON *obj;
|
||||||
@ -2986,8 +2992,31 @@ struct switch_live_array_s {
|
|||||||
switch_event_channel_id_t channel_id;
|
switch_event_channel_id_t channel_id;
|
||||||
switch_live_array_command_handler_t command_handler;
|
switch_live_array_command_handler_t command_handler;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
alias_node_t *aliases;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static switch_status_t la_broadcast(switch_live_array_t *la, cJSON **json)
|
||||||
|
{
|
||||||
|
alias_node_t *np;
|
||||||
|
|
||||||
|
if (la->aliases) {
|
||||||
|
switch_mutex_lock(la->mutex);
|
||||||
|
for (np = la->aliases; np; np = np->next) {
|
||||||
|
cJSON *dup = cJSON_Duplicate(*json, 1);
|
||||||
|
cJSON *data = cJSON_GetObjectItem(dup, "data");
|
||||||
|
|
||||||
|
cJSON_ReplaceItemInObject(dup, "eventChannel", cJSON_CreateString(np->event_channel));
|
||||||
|
cJSON_ReplaceItemInObject(data, "name", cJSON_CreateString(np->name));
|
||||||
|
|
||||||
|
switch_event_channel_broadcast(np->event_channel, &dup, __FILE__, la->channel_id);
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(la->mutex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch_event_channel_broadcast(la->event_channel, json, __FILE__, la->channel_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force)
|
SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *la, switch_bool_t visible, switch_bool_t force)
|
||||||
{
|
{
|
||||||
@ -3004,7 +3033,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_visible(switch_live_array_t *l
|
|||||||
cJSON_AddItemToObject(data, "action", cJSON_CreateString(visible ? "hide" : "show"));
|
cJSON_AddItemToObject(data, "action", cJSON_CreateString(visible ? "hide" : "show"));
|
||||||
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++));
|
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++));
|
||||||
|
|
||||||
switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, la->channel_id);
|
la_broadcast(la, &msg);
|
||||||
|
|
||||||
la->visible = visible;
|
la->visible = visible;
|
||||||
}
|
}
|
||||||
@ -3030,7 +3059,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_clear(switch_live_array_t *la)
|
|||||||
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1));
|
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(-1));
|
||||||
cJSON_AddItemToObject(data, "data", cJSON_CreateObject());
|
cJSON_AddItemToObject(data, "data", cJSON_CreateObject());
|
||||||
|
|
||||||
switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, la->channel_id);
|
la_broadcast(la, &msg);
|
||||||
|
|
||||||
while(np) {
|
while(np) {
|
||||||
cur = np;
|
cur = np;
|
||||||
@ -3146,6 +3175,60 @@ SWITCH_DECLARE(switch_bool_t) switch_live_array_isnew(switch_live_array_t *la)
|
|||||||
return la->new;
|
return la->new;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_bool_t) switch_live_array_clear_alias(switch_live_array_t *la, const char *event_channel, const char *name)
|
||||||
|
{
|
||||||
|
alias_node_t *np, *last = NULL;
|
||||||
|
switch_bool_t r = SWITCH_FALSE;
|
||||||
|
|
||||||
|
switch_mutex_lock(la->mutex);
|
||||||
|
for (np = la->aliases; np; np = np->next) {
|
||||||
|
if (!strcmp(np->event_channel, event_channel) && !strcmp(np->name, name)) {
|
||||||
|
r = SWITCH_TRUE;
|
||||||
|
|
||||||
|
if (last) {
|
||||||
|
last->next = np->next;
|
||||||
|
} else {
|
||||||
|
la->aliases = np->next;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
last = np;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
switch_mutex_unlock(la->mutex);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(switch_bool_t) switch_live_array_add_alias(switch_live_array_t *la, const char *event_channel, const char *name)
|
||||||
|
{
|
||||||
|
alias_node_t *node, *np;
|
||||||
|
switch_bool_t exist = SWITCH_FALSE;
|
||||||
|
|
||||||
|
switch_mutex_lock(la->mutex);
|
||||||
|
for (np = la->aliases; np && np->next; np = np->next) {
|
||||||
|
if (!strcmp(np->event_channel, event_channel) && !strcmp(np->name, name)) {
|
||||||
|
exist = SWITCH_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exist) {
|
||||||
|
node = switch_core_alloc(la->pool, sizeof(*node));
|
||||||
|
node->event_channel = switch_core_strdup(la->pool, event_channel);
|
||||||
|
node->name = switch_core_strdup(la->pool, name);
|
||||||
|
if (np) {
|
||||||
|
np->next = node;
|
||||||
|
} else {
|
||||||
|
la->aliases = node;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch_mutex_unlock(la->mutex);
|
||||||
|
|
||||||
|
return !exist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name,
|
SWITCH_DECLARE(switch_status_t) switch_live_array_create(const char *event_channel, const char *name,
|
||||||
switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP)
|
switch_event_channel_id_t channel_id, switch_live_array_t **live_arrayP)
|
||||||
{
|
{
|
||||||
@ -3259,7 +3342,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_del(switch_live_array_t *la, c
|
|||||||
cJSON_AddItemToObject(data, "data", cur->obj);
|
cJSON_AddItemToObject(data, "data", cur->obj);
|
||||||
cur->obj = NULL;
|
cur->obj = NULL;
|
||||||
|
|
||||||
switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, la->channel_id);
|
la_broadcast(la, &msg);
|
||||||
free(cur->name);
|
free(cur->name);
|
||||||
free(cur);
|
free(cur);
|
||||||
} else {
|
} else {
|
||||||
@ -3360,7 +3443,7 @@ SWITCH_DECLARE(switch_status_t) switch_live_array_add(switch_live_array_t *la, c
|
|||||||
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++));
|
cJSON_AddItemToObject(data, "wireSerno", cJSON_CreateNumber(la->serno++));
|
||||||
cJSON_AddItemToObject(data, "data", cJSON_Duplicate(node->obj, 1));
|
cJSON_AddItemToObject(data, "data", cJSON_Duplicate(node->obj, 1));
|
||||||
|
|
||||||
switch_event_channel_broadcast(la->event_channel, &msg, __FILE__, la->channel_id);
|
la_broadcast(la, &msg);
|
||||||
|
|
||||||
switch_mutex_unlock(la->mutex);
|
switch_mutex_unlock(la->mutex);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user