[svn-commits] simon.perreault: branch group/v6-new r270659 - /team/group/v6-new/channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Jun 15 15:29:04 CDT 2010


Author: simon.perreault
Date: Tue Jun 15 15:29:00 2010
New Revision: 270659

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=270659
Log:
Really fix get_our_media_address() definitively forever.

Modified:
    team/group/v6-new/channels/chan_sip.c

Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=270659&r1=270658&r2=270659
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Tue Jun 15 15:29:00 2010
@@ -9906,66 +9906,73 @@
 
 	/* Now, try to figure out where we want them to send data */
 	/* Is this a re-invite to move the media out, then use the original offer from caller  */
-
-	/*
-	 * Audio Destination IP:
-	 *
-	 * 1. Redirection IP.
-	 * 2. Specifically configured media address.
-	 * 3. Local address as specified by the RTP engine.
-	 * 4. The local IP as defined by chan_sip.
-	 *
-	 * Audio Destination Port:
-	 *
-	 * 1. Provided by the RTP engine.
-	 */
-	ast_sockaddr_copy(dest,
-			  !ast_sockaddr_isnull(&p->redirip)    ? &p->redirip    :
-			  !ast_sockaddr_isnull(&media_address) ? &media_address :
-			  !ast_sockaddr_is_any(addr)           ? addr           :
-			  &p->ourip);
-	ast_sockaddr_set_port(dest, ast_sockaddr_port(addr));
-
-	if (needvideo) {
+	if (!ast_sockaddr_isnull(&p->redirip)) {	/* If we have a redirection IP, use it */
+		ast_sockaddr_copy(dest, &p->redirip);
+	} else {
 		/*
-		 * Video Destination IP:
+		 * Audio Destination IP:
 		 *
-		 * 1. Redirection IP.
-		 * 2. Specifically configured media address.
-		 * 3. Local address as specified by the RTP engine.
-		 * 4. The local IP as defined by chan_sip.
+		 * 1. Specifically configured media address.
+		 * 2. Local address as specified by the RTP engine.
+		 * 3. The local IP as defined by chan_sip.
 		 *
-		 * Video Destination Port:
+		 * Audio Destination Port:
 		 *
 		 * 1. Provided by the RTP engine.
 		 */
-		ast_sockaddr_copy(vdest,
-				  !ast_sockaddr_isnull(&p->vredirip)   ? &p->vredirip    :
-				  !ast_sockaddr_isnull(&media_address) ? &media_address  :
-				  !ast_sockaddr_is_any(vaddr)          ? vaddr           :
+		ast_sockaddr_copy(dest,
+				  !ast_sockaddr_isnull(&media_address) ? &media_address :
+				  !ast_sockaddr_is_any(addr)           ? addr           :
 				  &p->ourip);
-		ast_sockaddr_set_port(vdest, ast_sockaddr_port(vaddr));
+		ast_sockaddr_set_port(dest, ast_sockaddr_port(addr));
+	}
+
+	if (needvideo) {
+		/* Determine video destination */
+		if (!ast_sockaddr_isnull(&p->vredirip)) {
+			ast_sockaddr_copy(vdest, &p->vredirip);
+		} else {
+			/*
+			 * Video Destination IP:
+			 *
+			 * 1. Specifically configured media address.
+			 * 2. Local address as specified by the RTP engine.
+			 * 3. The local IP as defined by chan_sip.
+			 *
+			 * Video Destination Port:
+			 *
+			 * 1. Provided by the RTP engine.
+			 */
+			ast_sockaddr_copy(vdest,
+					  !ast_sockaddr_isnull(&media_address) ? &media_address :
+					  !ast_sockaddr_is_any(vaddr)          ? vaddr          :
+					  &p->ourip);
+			ast_sockaddr_set_port(vdest, ast_sockaddr_port(vaddr));
+		}
 	}
 
 	if (needtext) {
-		/*
-		 * Text Destination IP:
-		 *
-		 * 1. Redirection IP.
-		 * 2. Specifically configured media address.
-		 * 3. Local address as specified by the RTP engine.
-		 * 4. The local IP as defined by chan_sip.
-		 *
-		 * Text Destination Port:
-		 *
-		 * 1. Provided by the RTP engine.
-		 */
-		ast_sockaddr_copy(tdest,
-				  !ast_sockaddr_isnull(&p->tredirip)   ? &p->tredirip    :
-				  !ast_sockaddr_isnull(&media_address) ? &media_address  :
-				  !ast_sockaddr_is_any(taddr)          ? taddr           :
-				  &p->ourip);
-		ast_sockaddr_set_port(tdest, ast_sockaddr_port(taddr));
+		/* Determine text destination */
+		if (!ast_sockaddr_isnull(&p->tredirip)) {
+			ast_sockaddr_copy(tdest, &p->tredirip);
+		} else {
+			/*
+			 * Text Destination IP:
+			 *
+			 * 1. Specifically configured media address.
+			 * 2. Local address as specified by the RTP engine.
+			 * 3. The local IP as defined by chan_sip.
+			 *
+			 * Text Destination Port:
+			 *
+			 * 1. Provided by the RTP engine.
+			 */
+			ast_sockaddr_copy(tdest,
+					  !ast_sockaddr_isnull(&media_address) ? &media_address  :
+					  !ast_sockaddr_is_any(taddr)          ? taddr           :
+					  &p->ourip);
+			ast_sockaddr_set_port(tdest, ast_sockaddr_port(taddr));
+		}
 	}
 }
 




More information about the svn-commits mailing list