fix auto-adjust
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15256 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
dfafd6988e
commit
a4221d43be
|
@ -1889,27 +1889,33 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
||||||
rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
|
rtp_flush_read_buffer(rtp_session, SWITCH_RTP_FLUSH_ONCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes && !(rtp_session->recv_msg.header.pt == rtp_session->cng_pt || rtp_session->recv_msg.header.pt == 13) &&
|
if (bytes && ((rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) || rtp_session->recv_msg.header.pt == 13)) {
|
||||||
|
bytes = 0;
|
||||||
|
goto recvfrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bytes &&
|
||||||
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
|
switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
|
||||||
if (++rtp_session->autoadj_tally >= 10) {
|
const char *tx_host;
|
||||||
const char *tx_host;
|
const char *old_host;
|
||||||
const char *old_host;
|
char bufa[30], bufb[30];
|
||||||
char bufa[30], bufb[30];
|
|
||||||
|
|
||||||
tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
|
tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
|
||||||
old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
|
old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
|
||||||
if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
|
if ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
|
||||||
const char *err;
|
const char *err;
|
||||||
uint32_t old = rtp_session->remote_port;
|
uint32_t old = rtp_session->remote_port;
|
||||||
|
|
||||||
if (!zstr(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
|
if (++rtp_session->autoadj_tally >= 10 && !zstr(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,
|
||||||
"Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
|
"Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
|
||||||
switch_sockaddr_get_port(rtp_session->from_addr));
|
switch_sockaddr_get_port(rtp_session->from_addr));
|
||||||
switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
|
switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(rtp_session->from_addr), SWITCH_FALSE, &err);
|
||||||
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
|
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Correct ip/port confirmed.\n");
|
||||||
|
switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue