]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
improve nat support
authorAnthony Minessale <anthony.minessale@gmail.com>
Wed, 13 Dec 2006 22:18:27 +0000 (22:18 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Wed, 13 Dec 2006 22:18:27 +0000 (22:18 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3639 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/switch_rtp.c

index 6edf27097890f08fc70b11eafd0775388c143a7d..43b462e748c5bfeaf073744cf8ab12a489b23bb1 100644 (file)
@@ -865,18 +865,15 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
 
                if (rtp_session->recv_msg.header.version) {
                        if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && rtp_session->from_addr->port) {
-                               if ((rtp_session->from_addr->port != rtp_session->remote_port)) {
+                char *tx_host;
+                char *old_host;
+                char bufa[30], bufb[30];
+                tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->from_addr);
+                old_host = switch_get_addr(bufb, sizeof(bufb), rtp_session->remote_addr);
+
+                               if ((rtp_session->from_addr->port != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
                                        const char *err;
-                                       char *tx_host;
                                        uint32_t old = rtp_session->remote_port;
-                                       char *old_host;
-                                       char bufa[30], bufb[30];
-
-                                       //switch_sockaddr_ip_get(&tx_host, rtp_session->from_addr);
-                                       //switch_sockaddr_ip_get(&old_host, rtp_session->remote_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);
 
                                        if (!switch_strlen_zero(tx_host) && rtp_session->from_addr->port > 0) {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Auto Changing port from %s:%u to %s:%u\n",