diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-22 20:37:05 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-06-22 20:37:05 +0000 |
commit | 9d47b0498a836777fd7015fc2720cedb141c19a4 (patch) | |
tree | 29f1a143f9f986c1e4ba81a4ea1fe9540ab0710b /channels | |
parent | c7483699476ed8647c3f72ad54f3ea1b147f28a3 (diff) |
ignore CANCEL request after having already received final response to INVITE
RFC 3261 section 9 states that a CANCEL has no effect on a
request to a UAS that has already given a final response. This
patch checks to make sure there is a pending invite before
allowing a CANCEL request to be processed, otherwise it responds
to the CANCEL with a "481 Call/Transaction Does Not Exist".
Review: https://reviewboard.asterisk.org/r/697/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@271977 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 60ab323f0..fa03d9c43 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -23079,7 +23079,14 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so req->ignore = 1; ast_debug(3, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno); } - + + /* RFC 3261 section 9. "CANCEL has no effect on a request to which a UAS has + * already given a final response." */ + if (!p->pendinginvite && (req->method == SIP_CANCEL)) { + transmit_response(p, "481 Call/Transaction Does Not Exist", req); + return res; + } + if (seqno >= p->icseq) /* Next should follow monotonically (but not necessarily incrementally -- thanks again to the genius authors of SIP -- |