[core]speed up call setup
This commit is contained in:
parent
da8e3b04db
commit
dc4bef79ec
|
@ -590,7 +590,7 @@ SWITCH_DECLARE(char *) get_addr(char *buf, switch_size_t len, struct sockaddr *s
|
|||
SWITCH_DECLARE(char *) get_addr6(char *buf, switch_size_t len, struct sockaddr_in6 *sa, socklen_t salen);
|
||||
|
||||
SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa);
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2, switch_bool_t ip_only);
|
||||
SWITCH_DECLARE(int) switch_cp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2);
|
||||
|
||||
/*!
|
||||
|
|
|
@ -2648,10 +2648,14 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
|
|||
}
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_ANSWER:
|
||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ANSWERED");
|
||||
switch_channel_mark_pre_answered(tech_pvt->channel);
|
||||
r = verto_send_media_indication(session, "verto.answer");
|
||||
break;
|
||||
case SWITCH_MESSAGE_INDICATE_PROGRESS:
|
||||
r = verto_send_media_indication(session, "verto.media");
|
||||
switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA");
|
||||
switch_channel_mark_pre_answered(tech_pvt->channel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -1256,7 +1256,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
port = switch_sockaddr_get_port(from_addr);
|
||||
host2 = switch_get_addr(buf2, sizeof(buf2), ice->addr);
|
||||
port2 = switch_sockaddr_get_port(ice->addr);
|
||||
cmp = switch_cmp_addr(from_addr, ice->addr);
|
||||
cmp = switch_cmp_addr(from_addr, ice->addr, SWITCH_FALSE);
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG4,
|
||||
"STUN from %s:%d %s\n", host, port, cmp ? "EXPECTED" : "IGNORED");
|
||||
|
@ -1266,7 +1266,7 @@ static void handle_ice(switch_rtp_t *rtp_session, switch_rtp_ice_t *ice, void *d
|
|||
rtp_session->wrong_addrs = 0;
|
||||
} else {
|
||||
if (((rtp_session->dtls && rtp_session->dtls->state != DS_READY) || !ice->ready || !ice->rready) &&
|
||||
rtp_session->wrong_addrs > 2 && rtp_session->ice_adj == 0) {
|
||||
(rtp_session->wrong_addrs > 2 || switch_cmp_addr(from_addr, ice->addr, SWITCH_TRUE)) && rtp_session->ice_adj == 0) {
|
||||
do_adj++;
|
||||
rtp_session->ice_adj = 1;
|
||||
rtp_session->wrong_addrs = 0;
|
||||
|
@ -7250,7 +7250,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t
|
|||
|
||||
/* RTCP Auto ADJ */
|
||||
if (*bytes && rtp_session->flags[SWITCH_RTP_FLAG_RTCP_AUTOADJ] && switch_sockaddr_get_port(rtp_session->rtcp_from_addr)) {
|
||||
if (!switch_cmp_addr(rtp_session->rtcp_from_addr, rtp_session->rtcp_remote_addr)) {
|
||||
if (!switch_cmp_addr(rtp_session->rtcp_from_addr, rtp_session->rtcp_remote_addr, SWITCH_FALSE)) {
|
||||
if (++rtp_session->rtcp_autoadj_tally >= rtp_session->rtcp_autoadj_threshold) {
|
||||
const char *err;
|
||||
uint32_t old = rtp_session->remote_rtcp_port;
|
||||
|
@ -7827,13 +7827,13 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||
goto recvfrom;
|
||||
|
||||
}
|
||||
} else if (!(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS) && !switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr)) {
|
||||
} else if (!(rtp_session->rtp_bugs & RTP_BUG_ACCEPT_ANY_PACKETS) && !switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr, SWITCH_FALSE)) {
|
||||
goto recvfrom;
|
||||
}
|
||||
}
|
||||
|
||||
if (bytes && rtp_session->flags[SWITCH_RTP_FLAG_AUTOADJ] && switch_sockaddr_get_port(rtp_session->rtp_from_addr)) {
|
||||
if (!switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr)) {
|
||||
if (!switch_cmp_addr(rtp_session->rtp_from_addr, rtp_session->remote_addr, SWITCH_FALSE)) {
|
||||
if (++rtp_session->autoadj_tally >= rtp_session->autoadj_threshold) {
|
||||
const char *err;
|
||||
uint32_t old = rtp_session->remote_port;
|
||||
|
|
|
@ -2349,7 +2349,7 @@ SWITCH_DECLARE(int) get_addr_int(switch_sockaddr_t *sa)
|
|||
return ntohs((unsigned short) s->sin_addr.s_addr);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2)
|
||||
SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *sa2, switch_bool_t ip_only)
|
||||
{
|
||||
struct sockaddr_in *s1;
|
||||
struct sockaddr_in *s2;
|
||||
|
@ -2377,17 +2377,21 @@ SWITCH_DECLARE(int) switch_cmp_addr(switch_sockaddr_t *sa1, switch_sockaddr_t *s
|
|||
|
||||
switch (ss1->sa_family) {
|
||||
case AF_INET:
|
||||
return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);
|
||||
if (ip_only) {
|
||||
return (s1->sin_addr.s_addr == s2->sin_addr.s_addr);
|
||||
} else {
|
||||
return (s1->sin_addr.s_addr == s2->sin_addr.s_addr && s1->sin_port == s2->sin_port);
|
||||
}
|
||||
case AF_INET6:
|
||||
if (s16->sin6_addr.s6_addr && s26->sin6_addr.s6_addr) {
|
||||
int i;
|
||||
|
||||
if (s16->sin6_port != s26->sin6_port)
|
||||
return 0;
|
||||
if (!ip_only) {
|
||||
if (s16->sin6_port != s26->sin6_port) return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
if (*((int32_t *) s16->sin6_addr.s6_addr + i) != *((int32_t *) s26->sin6_addr.s6_addr + i))
|
||||
return 0;
|
||||
if (*((int32_t *) s16->sin6_addr.s6_addr + i) != *((int32_t *) s26->sin6_addr.s6_addr + i)) return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
Loading…
Reference in New Issue