[asterisk-commits] tilghman: branch 1.4 r257467 - /branches/1.4/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 15 15:24:55 CDT 2010


Author: tilghman
Date: Thu Apr 15 15:24:50 2010
New Revision: 257467

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=257467
Log:
Don't recreate peer, when responding to a repeated deregistration attempt.

When a reply to a deregistration is lost in transmit, the client retries the
deregistration.  Previously, this would cause a realtime/autocreate peer to be
loaded back into memory, after it had already been correctly purged.  Instead,
we just want to resend the reply without loading the peer.

(closes issue #16908)
 Reported by: kkm
 Patches: 
       20100412__issue16908.diff.txt uploaded by tilghman (license 14)
 Tested by: kkm

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=257467&r1=257466&r2=257467
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Thu Apr 15 15:24:50 2010
@@ -9352,6 +9352,21 @@
 
 	ast_string_field_set(p, exten, name);
 	build_contact(p);
+	if (ast_test_flag(req, SIP_PKT_IGNORE)) {
+		/* Expires is a special case, where we only want to load the peer if this isn't a deregistration attempt */
+		const char *expires = get_header(req, "Expires");
+		int expire = atoi(expires);
+
+		if (ast_strlen_zero(expires)) { /* No expires header; look in Contact */
+			if ((expires = strcasestr(get_header(req, "Contact"), ";expires="))) {
+				expire = atoi(expires + 9);
+			}
+		}
+		if (!ast_strlen_zero(expires) && expire == 0) {
+			transmit_response_with_date(p, "200 OK", req);
+			return 0;
+		}
+	}
 	peer = find_peer(name, NULL, 1, 0);
 	if (!(peer && ast_apply_ha(peer->ha, sin))) {
 		/* Peer fails ACL check */




More information about the asterisk-commits mailing list