[asterisk-commits] bbryant: branch 1.8 r318917 - /branches/1.8/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 13 12:56:11 CDT 2011


Author: bbryant
Date: Fri May 13 12:56:04 2011
New Revision: 318917

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=318917
Log:
This patch allows TCP peers into the ast_db where they were previously
restricted.

(closes issue #18882)
Reported by: cmaj
Patches: 
      patch-chan_sip-1.8.3-rc2-allow-tcp-peer-store-db-and-readonly-rt-backend.diff.txt
      uploaded by cmaj (license 830)
Tested by: cmaj


Modified:
    branches/1.8/channels/chan_sip.c

Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=318917&r1=318916&r2=318917
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Fri May 13 12:56:04 2011
@@ -13186,7 +13186,8 @@
 		AST_APP_ARG(contact);
 	);
 
-	if (peer->rt_fromcontact) {
+	/* If read-only RT backend, then refresh from local DB cache */
+	if (peer->rt_fromcontact && sip_cfg.peer_rtupdate) {
 		return;
 	}
 	if (ast_db_get("SIP/Registry", peer->name, data, sizeof(data))) {
@@ -13505,11 +13506,8 @@
 	pvt->expiry = expire;
 	snprintf(data, sizeof(data), "%s:%d:%s:%s", ast_sockaddr_stringify(&peer->addr),
 		 expire, peer->username, peer->fullcontact);
-	/* Saving TCP connections is useless, we won't be able to reconnect
-		XXX WHY???? XXX
-		\todo Fix this immediately.
-	*/
-	if (!peer->rt_fromcontact && (peer->socket.type & SIP_TRANSPORT_UDP))
+	/* We might not immediately be able to reconnect via TCP, but try caching it anyhow */
+	if (!peer->rt_fromcontact || !sip_cfg.peer_rtupdate)
 		ast_db_put("SIP/Registry", peer->name, data);
 	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "ChannelType: SIP\r\nPeer: SIP/%s\r\nPeerStatus: Registered\r\nAddress: %s\r\n", peer->name,  ast_sockaddr_stringify(&peer->addr));
 
@@ -26735,7 +26733,8 @@
 	if (ast_test_flag(&peer->flags[1], SIP_PAGE2_ALLOWSUBSCRIBE)) {
 		sip_cfg.allowsubscribe = TRUE;	/* No global ban any more */
 	}
-	if (peer->host_dynamic && !peer->is_realtime) {
+	/* If read-only RT backend, then refresh from local DB cache */
+	if (peer->host_dynamic && !sip_cfg.peer_rtupdate) {
 		reg_source_db(peer);
 	}
 




More information about the asterisk-commits mailing list