summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Bryant <bbryant@digium.com>2011-05-13 17:58:53 +0000
committerBrett Bryant <bbryant@digium.com>2011-05-13 17:58:53 +0000
commit547490144c434c9ed4fcf243aaa19a3c7a1924f0 (patch)
tree9ca15e4ec0ed81ba8b7061fc0cc21f89e72a2197
parentdb89abf0bd854ae09a7044b622b1f0260ae77a7e (diff)
Merged revisions 318917 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r318917 | bbryant | 2011-05-13 13:56:04 -0400 (Fri, 13 May 2011) | 11 lines 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 ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318918 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--channels/chan_sip.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6c3527537..fa525a5d2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -13445,7 +13445,8 @@ static void reg_source_db(struct sip_peer *peer)
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))) {
@@ -13764,11 +13765,8 @@ static enum parse_register_result parse_register_contact(struct sip_pvt *pvt, st
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));
@@ -27080,7 +27078,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
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);
}