[Freeswitch-svn] [commit] r8563 - freeswitch/trunk/src

Freeswitch SVN anthm at freeswitch.org
Fri May 23 19:53:10 EDT 2008


Author: anthm
Date: Fri May 23 19:53:10 2008
New Revision: 8563

Modified:
   freeswitch/trunk/src/switch_rtp.c

Log:
more nat goodies for proxy media mode

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Fri May 23 19:53:10 2008
@@ -1130,7 +1130,34 @@
 			goto end;
 		}
 		
-		if (bytes > 0) {
+		if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
+			const char *tx_host;
+			const 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 ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
+				const char *err;
+				uint32_t old = rtp_session->remote_port;
+
+				if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
+					if (++rtp_session->autoadj_tally >= 10) {
+						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
+										  "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
+										  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), &err);
+					}
+				}
+			}
+		}
+
+		if (bytes && rtp_session->autoadj_window) {
+			if (--rtp_session->autoadj_window == 0) {
+				switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
+			}
+		}
+
+		if (bytes) {
 			rtp_session->missed_count = 0;
 		}
 
@@ -1372,33 +1399,6 @@
 			goto end;
 		}
 		
-		if (bytes && switch_test_flag(rtp_session, SWITCH_RTP_FLAG_AUTOADJ) && switch_sockaddr_get_port(rtp_session->from_addr)) {
-			const char *tx_host;
-			const 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 ((switch_sockaddr_get_port(rtp_session->from_addr) != rtp_session->remote_port) || strcmp(tx_host, old_host)) {
-				const char *err;
-				uint32_t old = rtp_session->remote_port;
-
-				if (!switch_strlen_zero(tx_host) && switch_sockaddr_get_port(rtp_session->from_addr) > 0) {
-					if (++rtp_session->autoadj_tally >= 10) {
-						switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,
-										  "Auto Changing port from %s:%u to %s:%u\n", old_host, old, tx_host,
-										  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), &err);
-					}
-				}
-			}
-		}
-
-		if (rtp_session->autoadj_window) {
-			if (--rtp_session->autoadj_window == 0) {
-				switch_clear_flag_locked(rtp_session, SWITCH_RTP_FLAG_AUTOADJ);
-			}
-		}
-
 		if (bytes && rtp_session->cng_pt && rtp_session->recv_msg.header.pt == rtp_session->cng_pt) {
 			goto do_continue;
 		}



More information about the Freeswitch-svn mailing list