summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2008-12-12 18:17:12 +0000
committerJoshua Colp <jcolp@digium.com>2008-12-12 18:17:12 +0000
commit44b93b68598057182ea86490c0f8d6ef50671e0a (patch)
treee3d2747d7e70891540e5e3a07cc41ba40ecad155 /channels
parent39e47e88e9710af6ca9a7c5b7949257b3c95425b (diff)
When a device registers we need to unlink them (if linked) from the peers_by_ip container and link them back in since their IP address has changed. This would have manifested itself if you configured a new device (as type=peer), registered, and then tried to place a call from the device. Since the peer was not linked into the peers_by_ip container it would have never been found.
(closes issue #13811) Reported by: pj git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@163629 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 51fc59b2a..ae9e99c0c 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11153,6 +11153,11 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
oldsin = peer->addr;
+ /* If we were already linked into the peers_by_ip container unlink ourselves so nobody can find us */
+ if (peer->addr.sin_addr.s_addr) {
+ ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table");
+ }
+
/* Check that they're allowed to register at this IP */
/* XXX This could block for a long time XXX */
/*! \todo Check NAPTR/SRV if we have not got a port in the URI */
@@ -11184,6 +11189,9 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
peer->addr = pvt->recv;
}
+ /* Now that our address has been updated put ourselves back into the container for lookups */
+ ao2_t_link(peers_by_ip, peer, "ao2_link into peers_by_ip table");
+
/* Save SIP options profile */
peer->sipoptions = pvt->sipoptions;