[asterisk-commits] russell: trunk r281533 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Aug 10 11:55:56 CDT 2010
Author: russell
Date: Tue Aug 10 11:55:50 2010
New Revision: 281533
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281533
Log:
Merged revisions 281532 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r281532 | russell | 2010-08-10 11:54:20 -0500 (Tue, 10 Aug 2010) | 8 lines
Ensure that the proper external address is used for the RTP destination.
(closes issue #17044)
Reported by: ebroad
Tested by: ebroad
Review: https://reviewboard.asterisk.org/r/566/
........
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=281533&r1=281532&r2=281533
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Aug 10 11:55:50 2010
@@ -10262,6 +10262,8 @@
struct ast_sockaddr *taddr, struct ast_sockaddr *dest,
struct ast_sockaddr *vdest, struct ast_sockaddr *tdest)
{
+ int use_externip = 0;
+
/* First, get our address */
ast_rtp_instance_get_local_address(p->rtp, addr);
if (p->vrtp) {
@@ -10270,6 +10272,11 @@
if (p->trtp) {
ast_rtp_instance_get_local_address(p->trtp, taddr);
}
+
+ /* If our real IP differs from the local address returned by the RTP engine, use it. */
+ /* The premise is that if we are already using that IP to communicate with the client, */
+ /* we should be using it for RTP too. */
+ use_externip = ast_sockaddr_cmp_addr(&p->ourip, addr);
/* 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 */
@@ -10289,7 +10296,7 @@
*/
ast_sockaddr_copy(dest,
!ast_sockaddr_isnull(&media_address) ? &media_address :
- !ast_sockaddr_is_any(addr) ? addr :
+ !ast_sockaddr_is_any(addr) && !use_externip ? addr :
&p->ourip);
ast_sockaddr_set_port(dest, ast_sockaddr_port(addr));
}
@@ -10312,7 +10319,7 @@
*/
ast_sockaddr_copy(vdest,
!ast_sockaddr_isnull(&media_address) ? &media_address :
- !ast_sockaddr_is_any(vaddr) ? vaddr :
+ !ast_sockaddr_is_any(vaddr) && !use_externip ? vaddr :
&p->ourip);
ast_sockaddr_set_port(vdest, ast_sockaddr_port(vaddr));
}
@@ -10336,7 +10343,7 @@
*/
ast_sockaddr_copy(tdest,
!ast_sockaddr_isnull(&media_address) ? &media_address :
- !ast_sockaddr_is_any(taddr) ? taddr :
+ !ast_sockaddr_is_any(taddr) && !use_externip ? taddr :
&p->ourip);
ast_sockaddr_set_port(tdest, ast_sockaddr_port(taddr));
}
More information about the asterisk-commits
mailing list