用于INFO和INVITE方法的SIP CSeq

请考虑此示例SIP对话框

    A-->--INVITE-->--B CSeq 101
    A--<--TRYING--<--B CSeq 101
    A--<--200 OK--<--B CSeq 101
    A-->-- ACK  -->--B CSeq 101
    A-->-- INFO -->--B CSeq 2
    A--<-- 500  --<--B CSeq 2
    ...

在处理SIP处理代码时,我们对SIP INFO消息的CSeq进行了验证,以使对话框大于为INVITE发送的对话框.
然而,如上面的SIP流程所示,远程SIP网关之一将其发送为较低,即2而不是预期的102或更高.

RFC https://www.ietf.org/rfc/rfc3261.txt声明了这一点

Requests within a dialog MUST contain strictly monotonically
increasing and contiguous CSeq sequence numbers (increasing-by-one) in
each direction

那么,观察到的行为是否违反了RFC?

最佳答案 是的.你解释了正确的文字.

SIP INFO消息上的RFC表示CSeq头值遵循RFC3261中的机制:

The Info Package mechanism does not define a delivery order
mechanism. Info Packages can rely on the CSeq header field [RFC3261]
to detect if an INFO request is received out of order.

但是,请记住,您不能依赖收到的CSeq编号只比之前收到的编号高一个(https://tools.ietf.org/html/rfc3261#section-12.2.2):

It is possible for the
CSeq sequence number to be higher than the remote sequence number by
more than one. This is not an error condition, and a UAS SHOULD be
prepared to receive and process requests with CSeq values more than
one higher than the previous received request. The UAS MUST then set
the remote sequence number to the value of the sequence number in the
CSeq header field value in the request.

If a proxy challenges a request generated by the UAC, the UAC has
to resubmit the request with credentials. The resubmitted request
will have a new CSeq number. The UAS will never see the first
request, and thus, it will notice a gap in the CSeq number space.
Such a gap does not represent any error condition.

点赞