[svn-commits] file: trunk r163629 - /trunk/channels/chan_sip.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Dec 12 12:17:13 CST 2008


Author: file
Date: Fri Dec 12 12:17:12 2008
New Revision: 163629

URL: http://svn.digium.com/view/asterisk?view=rev&rev=163629
Log:
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

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=163629&r1=163628&r2=163629
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Dec 12 12:17:12 2008
@@ -11153,6 +11153,11 @@
 
 	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 */
@@ -11183,6 +11188,9 @@
 		   with */
 		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;




More information about the svn-commits mailing list