[asterisk-commits] file: trunk r41285 - /trunk/main/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Aug 29 16:41:17 MST 2006


Author: file
Date: Tue Aug 29 18:41:16 2006
New Revision: 41285

URL: http://svn.digium.com/view/asterisk?rev=41285&view=rev
Log:
Move the direct bridge write to after the NAT handling code

Modified:
    trunk/main/rtp.c

Modified: trunk/main/rtp.c
URL: http://svn.digium.com/view/asterisk/trunk/main/rtp.c?rev=41285&r1=41284&r2=41285&view=diff
==============================================================================
--- trunk/main/rtp.c (original)
+++ trunk/main/rtp.c Tue Aug 29 18:41:16 2006
@@ -1042,15 +1042,12 @@
 		return &ast_null_frame;
 	}
 
-	if (version != 2)
-		return &ast_null_frame;
-	/* Ignore if the other side hasn't been given an address
-	   yet.  */
+	/* If we don't have the other side's address, then ignore this */
 	if (!rtp->them.sin_addr.s_addr || !rtp->them.sin_port)
 		return &ast_null_frame;
 
+	/* Send to whoever send to us if NAT is turned on */
 	if (rtp->nat) {
-		/* Send to whoever sent to us */
 		if ((rtp->them.sin_addr.s_addr != sin.sin_addr.s_addr) ||
 		    (rtp->them.sin_port != sin.sin_port)) {
 			rtp->them = sin;
@@ -1064,6 +1061,13 @@
 				ast_log(LOG_DEBUG, "RTP NAT: Got audio from other end. Now sending to address %s:%d\n", ast_inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port));
 		}
 	}
+
+	/* If we are bridged to another RTP stream, send direct */
+	if (rtp->bridged && !bridge_p2p_write(rtp, rtpheader, res, hdrlen))
+		return &ast_null_frame;
+
+	if (version != 2)
+		return &ast_null_frame;
 
 	payloadtype = (seqno & 0x7f0000) >> 16;
 	padding = seqno & (1 << 29);



More information about the asterisk-commits mailing list