[asterisk-commits] eliel: branch 1.4 r197562 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 28 10:21:46 CDT 2009


Author: eliel
Date: Thu May 28 10:21:32 2009
New Revision: 197562

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=197562
Log:
Use the address we already know when reloading a peer with nat=yes.

If we already have an address for a peer, and we are reloading the sip
configuration, try to use that address to contact the peer, instead of
getting it from the Contact.

(closes issue #15194)
Reported by: ibc
Patches:
      sip.patch uploaded by eliel (license 64)
      Tested by: manwe


Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=197562&r1=197561&r2=197562
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu May 28 10:21:32 2009
@@ -17699,8 +17699,11 @@
 		 * address listed on the entry (or if it's 'dynamic'), then we need to
 		 * parse the entry to obtain the IP address, so a dynamic host can be
 		 * contacted immediately after reload (as opposed to waiting for it to
-		 * register once again). */
-		__set_address_from_contact(fullcontact, &peer->addr);
+		 * register once again). But if we have an address for this peer and NAT was
+		 * specified, use that address instead. */
+		if (!ast_test_flag(&peer->flags[0], SIP_NAT_ROUTE) || !peer->addr.sin_addr.s_addr) {
+			__set_address_from_contact(fullcontact, &peer->addr);
+		}
 	}
 
 	if (!ast_test_flag(&global_flags[1], SIP_PAGE2_IGNOREREGEXPIRE) && ast_test_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC) && realtime) {




More information about the asterisk-commits mailing list