diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-20 17:48:42 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-20 17:48:42 +0000 |
commit | 93c58b4bdbdfa703e9fb4137b7dd01ce6df00075 (patch) | |
tree | 88267264f033a787aa7fd78505fd73c342dc2138 | |
parent | f16f0627aa78d9dc22e5b874d18edaea32c39843 (diff) |
We don't handle 4XX responses to BYE well. According to
section 15 of RFC 3261, we should terminate a dialog if we
receive a 481 or 408 in response to our BYE. Since I am aware
of at least one phone manufacturer who may sometimes send a
404 as well, I am being liberal and saying that any 4XX response
to a BYE should result in a terminated dialog.
(closes issue #12994)
Reported by: pabelanger
Patches:
12994.patch uploaded by putnopvut (license 60)
Closes AST-129
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@158071 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | channels/chan_sip.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index a9422d081..0afe2d596 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12869,6 +12869,20 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_ gettag(req, "To", tag, sizeof(tag)); ast_string_field_set(p, theirtag, tag); } + + /* RFC 3261 Section 15 specifies that if we receive a 408 or 481 + * in response to a BYE, then we should end the current dialog + * and session. There is no mention in the spec of other 4XX responses, + * but it is known that at least one phone manufacturer potentially + * will send a 404 in response to a BYE, so we'll be liberal in what + * we accept and end the dialog and session if we receive any 4XX + * response to a BYE. + */ + if (resp >= 400 && resp < 500 && sipmethod == SIP_BYE) { + ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); + return; + } + if (p->relatedpeer && p->method == SIP_OPTIONS) { /* We don't really care what the response is, just that it replied back. Well, as long as it's not a 100 response... since we might |