diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-04-15 20:24:50 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-04-15 20:24:50 +0000 |
commit | 5f1c004a4c10cffb45e79ba04cff5fcb3fc930d0 (patch) | |
tree | 29f104395f59359943bb9b8c649193423a55893e | |
parent | 082499c71c2ead99a1424648477dc961e858e073 (diff) |
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
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@257467 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 831f433a3..fdb4c98e3 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9352,6 +9352,21 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr 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 */ |