FS-5256 --resolve

This commit is contained in:
Anthony Minessale 2013-04-02 19:08:28 -05:00
parent 805514192c
commit 293ed932e8
1 changed files with 21 additions and 9 deletions

View File

@ -697,7 +697,6 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
if (ice->sending != 0) { if (ice->sending != 0) {
ice->stuncount = ice->default_stuncount; ice->stuncount = ice->default_stuncount;
ice->sending--; ice->sending--;
goto end;
} }
#endif #endif
@ -741,7 +740,7 @@ static switch_status_t ice_out(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice)
bytes = switch_stun_packet_length(packet); bytes = switch_stun_packet_length(packet);
printf("SEND.....\n");
switch_socket_sendto(sock_output, ice->addr, 0, (void *) packet, &bytes); switch_socket_sendto(sock_output, ice->addr, 0, (void *) packet, &bytes);
ice->stuncount = ice->default_stuncount; ice->stuncount = ice->default_stuncount;
@ -995,7 +994,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
bytes = switch_stun_packet_length(rpacket); bytes = switch_stun_packet_length(rpacket);
if (!switch_cmp_addr(from_addr, ice->addr)) { if ((ice->type & ICE_VANILLA) && ice->ice_params && !switch_cmp_addr(from_addr, ice->addr)) {
const char *host; const char *host;
switch_port_t port; switch_port_t port;
char buf[80] = ""; char buf[80] = "";
@ -3038,6 +3037,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
switch_rtp_ice_t *ice; switch_rtp_ice_t *ice;
char *host = NULL; char *host = NULL;
switch_port_t port = 0; switch_port_t port = 0;
char bufc[30];
if (proto == IPR_RTP) { if (proto == IPR_RTP) {
ice = &rtp_session->ice; ice = &rtp_session->ice;
@ -3074,12 +3075,23 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_activate_ice(switch_rtp_t *rtp_sessio
ice->default_stuncount = RTP_DEFAULT_STUNCOUNT; ice->default_stuncount = RTP_DEFAULT_STUNCOUNT;
ice->stuncount = 0; ice->stuncount = 0;
host = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr; if ((ice->type & ICE_VANILLA) && ice->ice_params) {
port = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port; host = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_addr;
port = ice->ice_params->cands[ice->ice_params->chosen[ice->proto]][ice->proto].con_port;
if (!host || !port || switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !ice->addr) { if (!host || !port || switch_sockaddr_info_get(&ice->addr, host, SWITCH_UNSPEC, port, 0, rtp_session->pool) != SWITCH_STATUS_SUCCESS || !ice->addr) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error setting remote host!\n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
}
} else {
if (proto == IPR_RTP) {
ice->addr = rtp_session->remote_addr;
} else {
ice->addr = rtp_session->rtcp_remote_addr;
}
host = (char *)switch_get_addr(bufc, sizeof(bufc), ice->addr);
port = switch_sockaddr_get_port(ice->addr);
} }
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Activating %s %s ICE: %s %s:%d\n", switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_NOTICE, "Activating %s %s ICE: %s %s:%d\n",