mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 16:39:14 +00:00
FS-11322: [freeswitch-core] Change ice handling to work with FireFox when in turn mode #resolve
This commit is contained in:
parent
d521e708d3
commit
9e09a8e8b5
@ -1197,7 +1197,9 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||||||
uint8_t do_adj = 0;
|
uint8_t do_adj = 0;
|
||||||
switch_time_t now = switch_micro_time_now();
|
switch_time_t now = switch_micro_time_now();
|
||||||
int cmp = 0;
|
int cmp = 0;
|
||||||
|
int cur_idx = -1;//, is_relay = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (is_rtcp) {
|
if (is_rtcp) {
|
||||||
from_addr = rtp_session->rtcp_from_addr;
|
from_addr = rtp_session->rtcp_from_addr;
|
||||||
sock_output = rtp_session->rtcp_sock_output;
|
sock_output = rtp_session->rtcp_sock_output;
|
||||||
@ -1250,46 +1252,42 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||||||
if (!do_adj) {
|
if (!do_adj) {
|
||||||
rtp_session->wrong_addrs++;
|
rtp_session->wrong_addrs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < ice->ice_params->cand_idx[ice->proto]; i++) {
|
||||||
|
if (!strcmp(ice->ice_params->cands[i][ice->proto].con_addr, host)) {
|
||||||
|
cur_idx = i;
|
||||||
|
//if (!strcasecmp(ice->ice_params->cands[i][ice->proto].cand_type, "relay")) {
|
||||||
|
// is_relay = 1;
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!strcasecmp(ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].cand_type, "relay")) {
|
||||||
|
do_adj++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ice->type & ICE_VANILLA) && ice->ice_params && do_adj) {
|
if ((ice->type & ICE_VANILLA) && ice->ice_params && do_adj) {
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
ice->missed_count = 0;
|
ice->missed_count = 0;
|
||||||
ice->rready = 1;
|
ice->rready = 1;
|
||||||
|
|
||||||
for (i = 0; i < ice->ice_params->cand_idx[ice->proto]; i++) {
|
if (cur_idx > -1) {
|
||||||
if (ice->ice_params->cands[i][ice->proto].con_port == port) {
|
ice->ice_params->chosen[ice->proto] = cur_idx;
|
||||||
if (!strcmp(ice->ice_params->cands[i][ice->proto].con_addr, host) &&
|
|
||||||
ice->ice_params->cands[i][ice->proto].cand_type &&
|
|
||||||
!strcmp(ice->ice_params->cands[i][ice->proto].cand_type, "relay")) {
|
|
||||||
|
|
||||||
if (elapsed < 1000) {
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_WARNING,
|
|
||||||
"Skiping RELAY stun/%s/dtls port change from %s:%u to %s:%u\n", is_rtcp ? "rtcp" : "rtp",
|
|
||||||
host2, port2,
|
|
||||||
host, port);
|
|
||||||
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE,
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE,
|
||||||
"Auto Changing %s stun/%s/dtls port from %s:%u to %s:%u\n", rtp_type(rtp_session), is_rtcp ? "rtcp" : "rtp",
|
"Auto Changing %s stun/%s/dtls port from %s:%u to %s:%u idx:%d\n", rtp_type(rtp_session), is_rtcp ? "rtcp" : "rtp",
|
||||||
host2, port2,
|
host2, port2,
|
||||||
host, port);
|
host, port, cur_idx);
|
||||||
|
|
||||||
switch_rtp_change_ice_dest(rtp_session, ice, host, port);
|
switch_rtp_change_ice_dest(rtp_session, ice, host, port);
|
||||||
ice->last_ok = now;
|
ice->last_ok = now;
|
||||||
rtp_session->wrong_addrs = 0;
|
rtp_session->wrong_addrs = 0;
|
||||||
}
|
}
|
||||||
if (cmp) {
|
//if (cmp) {
|
||||||
switch_socket_sendto(sock_output, from_addr, 0, (void *) rpacket, &bytes);
|
switch_socket_sendto(sock_output, from_addr, 0, (void *) rpacket, &bytes);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
} else if (packet->header.type == SWITCH_STUN_BINDING_ERROR_RESPONSE) {
|
} else if (packet->header.type == SWITCH_STUN_BINDING_ERROR_RESPONSE) {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user