aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreliel <eliel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-28 15:21:32 +0000
committereliel <eliel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-28 15:21:32 +0000
commitf1c6d8eecf422bab8d0ed61b239e978a8b97f829 (patch)
tree87f96f8071ae31ad03b858fde287411f7e7ee8a2
parentc57a726f0099e2ff550bf8de4e9644f66c65a37b (diff)
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 git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@197562 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b457d4fe2..ce859d7c1 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -17699,8 +17699,11 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
* 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) {