Module: sems Branch: master Commit: aacd0b98d5b701db739f6fee77893ed27ae7b33b URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=aacd0b98d5b701db739f6fee77893ed27ae7b33b
Author: Stefan Sayer <[email protected]> Committer: Stefan Sayer <[email protected]> Date: Wed Dec 7 18:31:54 2011 +0100 add Retry-After: 0 to NOTIFY 500 response on low CSeq this may prevent some peers to drop the subscription dialog usage when receiving a 500 reply to NOTIFY for more details see https://lists.cs.columbia.edu/pipermail/sip-implementors/2011-November/027955.html port of 4e023507 --- core/AmSipDialog.cpp | 11 +++++++++-- core/AmSipHeaders.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index bcf763b..ee7483d 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -155,9 +155,16 @@ void AmSipDialog::onRxRequest(const AmSipRequest& req) // Sanity checks if (r_cseq_i && req.cseq <= r_cseq){ + string hdrs; + if (req.method == "NOTIFY") { + // clever trick to not break subscription dialog usage + // for implementations which follow 3265 instead of 5057 + hdrs = SIP_HDR_COLSP(SIP_HDR_RETRY_AFTER) "0" CRLF; + } + INFO("remote cseq lower than previous ones - refusing request\n"); // see 12.2.2 - reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR, "", + reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR, hdrs, next_hop_for_replies ? next_hop_ip : "", next_hop_for_replies ? next_hop_port : 0); return; @@ -166,7 +173,7 @@ void AmSipDialog::onRxRequest(const AmSipRequest& req) if (req.method == SIP_METH_INVITE) { if(pending_invites || ((oa_trans.state != OA_None) && (oa_trans.state != OA_Completed))) { reply_error(req, 491, SIP_REPLY_PENDING, - "Retry-After: " + int2str(get_random() % 10) + CRLF, + SIP_HDR_COLSP(SIP_HDR_RETRY_AFTER) + int2str(get_random() % 10) + CRLF, next_hop_for_replies ? next_hop_ip : "", next_hop_for_replies ? next_hop_port : 0); return; diff --git a/core/AmSipHeaders.h b/core/AmSipHeaders.h index 85dc2e5..1ea0d08 100644 --- a/core/AmSipHeaders.h +++ b/core/AmSipHeaders.h @@ -38,6 +38,7 @@ #define SIP_HDR_PROXY_AUTHENTICATE "Proxy-Authenticate" #define SIP_HDR_WWW_AUTHENTICATE "WWW-Authenticate" #define SIP_HDR_ALLOW "Allow" +#define SIP_HDR_RETRY_AFTER "Retry-After" #define SIP_HDR_COL(_hdr) _hdr ":" #define SIP_HDR_COLSP(_hdr) SIP_HDR_COL(_hdr) " " _______________________________________________ Semsdev mailing list [email protected] http://lists.iptel.org/mailman/listinfo/semsdev
