diff --git a/core/AmSipDialog.cpp b/core/AmSipDialog.cpp index 935a1f5b..896868bf 100644 --- a/core/AmSipDialog.cpp +++ b/core/AmSipDialog.cpp @@ -112,7 +112,14 @@ void AmSipDialog::updateStatus(const AmSipRequest& req) if (r_cseq_i && req.cseq <= r_cseq){ INFO("remote cseq lower than previous ones - refusing request\n"); // see 12.2.2 - reply_error(req, 500, SIP_REPLY_SERVER_INTERNAL_ERROR, "", + 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; + } + + 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; @@ -121,7 +128,7 @@ void AmSipDialog::updateStatus(const AmSipRequest& req) if (req.method == "INVITE") { if (pending_invites) { reply_error(req,500, SIP_REPLY_SERVER_INTERNAL_ERROR, - "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 00b14703..39e59743 100644 --- a/core/AmSipHeaders.h +++ b/core/AmSipHeaders.h @@ -34,6 +34,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) " "