[asterisk-commits] file: branch 1.4 r47645 - /branches/1.4/main/rtp.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Nov 14 21:45:25 MST 2006


Author: file
Date: Tue Nov 14 22:45:24 2006
New Revision: 47645

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47645
Log:
If NAT detection is turned on or already detected then say NAT is active when setting the remote RTP peer when doing early bridging. (issue #8365 reported by marcelbarbulescu)

Modified:
    branches/1.4/main/rtp.c

Modified: branches/1.4/main/rtp.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/rtp.c?view=diff&rev=47645&r1=47644&r2=47645
==============================================================================
--- branches/1.4/main/rtp.c (original)
+++ branches/1.4/main/rtp.c Tue Nov 14 22:45:24 2006
@@ -1390,7 +1390,7 @@
 	struct ast_rtp_protocol *destpr = NULL, *srcpr = NULL;
 	enum ast_rtp_get_result audio_dest_res = AST_RTP_GET_FAILED, video_dest_res = AST_RTP_GET_FAILED;
 	enum ast_rtp_get_result audio_src_res = AST_RTP_GET_FAILED, video_src_res = AST_RTP_GET_FAILED;
-	int srccodec;
+	int srccodec, nat_active = 0;
 
 	/* Lock channels */
 	ast_channel_lock(dest);
@@ -1446,8 +1446,11 @@
 	/* Consider empty media as non-existant */
 	if (audio_src_res == AST_RTP_TRY_NATIVE && !srcp->them.sin_addr.s_addr)
 		srcp = NULL;
+	/* If the client has NAT stuff turned on then just safe NAT is active */
+	if (srcp && (srcp->nat || ast_test_flag(srcp, FLAG_NAT_ACTIVE)))
+		nat_active = 1;
 	/* Bridge media early */
-	if (destpr->set_rtp_peer(dest, srcp, vsrcp, srccodec, srcp ? ast_test_flag(srcp, FLAG_NAT_ACTIVE) : 0))
+	if (destpr->set_rtp_peer(dest, srcp, vsrcp, srccodec, nat_active))
 		ast_log(LOG_WARNING, "Channel '%s' failed to setup early bridge to '%s'\n", dest->name, src ? src->name : "<unspecified>");
 	ast_channel_unlock(dest);
 	if (src)



More information about the asterisk-commits mailing list