summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorEliel C. Sardanons <eliels@gmail.com>2009-05-28 16:01:48 +0000
committerEliel C. Sardanons <eliels@gmail.com>2009-05-28 16:01:48 +0000
commita109652532af6a34fa6e7809718e496edf06908e (patch)
tree2935f9e9e09075ff708e27b70ca8c8071b02f426 /channels/chan_sip.c
parent98ce0e5b6c811ff8037e3267323f39a046c0badc (diff)
Merged revisions 197562 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r197562 | eliel | 2009-05-28 11:21:32 -0400 (Thu, 28 May 2009) | 13 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@197621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-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 ce12fc779..cf7dd08fd 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23992,10 +23992,13 @@ 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). */
+ * register once again). But if we have an address for this peer and NAT was
+ * specified, use that address instead. */
/* XXX May need to revisit the final argument; does the realtime DB store whether
* the original contact was over TLS or not? XXX */
- __set_address_from_contact(fullcontact->str, &peer->addr, 0);
+ if (!ast_test_flag(&peer->flags[0], SIP_NAT_ROUTE) || !peer->addr.sin_addr.s_addr) {
+ __set_address_from_contact(fullcontact->str, &peer->addr, 0);
+ }
}
if (srvlookup && peer->dnsmgr == NULL) {