2022年2月19日 星期六

SIP dialog

INVITESUBSCRIBE... 可建立 dialg。

使用 tag 作為 dialog 識別在 RFC 3261 是強制的,但在 RFC 2543 是 optional。(有一端是 RFC 3261 的話,至少 From Tag 或 To Tag 中會有一個,RFC 2543v會保留嘛?)

...

12.2 Requests within a Dialog

兩個 UA 建立 dialog 後,任一端需要時可發起新 transaction。請求可 (還是有 Route Set 時必須) 包含 Record-Route 和 Contact。這些請求不能改變 dialog 的 route set (為什麼?)。這些中,屬於 target refresh request 才可以改變 remote target URI (什麼是 target?什麼是 remote target URI?依建立 dialog 的 method 而有不同?),並不能更新 route set。更新 route set 和 RFC2543 系統會有嚴重相容問題 (什麼問題?)。INVITE 建立的 dialog,唯一的 target refresh request 是 re-INVITE。ACK 並不是 target refresh request。

12.2.1 UAC Behavior

12.2.1.1 Generating the Request

...

target refresh request 應該要有 Contact,且除非有改變的需要,應該和 dialog 內之前的請求一致。如果 "secure" flag 是 true,必須是 SIPS URI。如同 Section 12.2.2 所討論,target refresh request 的 Contact 更新 remote target URI,不是 target refresh request 不更新 remote target URI。

請求剩下部份照 Section 8.1.1 描述形成。compute the address of the server,照 Section 8.1.2 送請求,一般送給 topmost Route 或沒有時送給 Request-URI。Subject to certain restrictions,允許送給不在 route set 的其它位址,例如, default outbound proxy。

12.2.1.2 Processing the Responses

如果 client transaction timeout,視同收到 408 Request Timeout。

收到 3xx,行為描述在 Section 8.1.3.4.

target refresh request 收到 2xx,如果有 Contact,必須取代為 dialog 的新的 remote target URI。

481 Call/Transaction Does Not Exist 或 408 Request Timeout,應該結束 dialog。INVITE 的 dialog 結束,包含送 BYE。

12.2.2 UAS Behavior

如果收到請求有 To tag,UAS core 比對 dialog 符合,先如同 Section 8.2 處理。如果不符合,可能是 UAS 有重啟、或收到要給其它 UAS 的請求 (possibly failed) UAS (the UASs can construct the To tags so that a UAS can identify that the tag was for a UAS for which it is providing recovery)、或者純粹跑錯。UAS 可以基於 To tag 決定是否接受來提供 robustness,讓 dialog 即使重啟仍可以維持。提供此功能需考慮維持 CSeq 序號增加、重建 route set、和接受 out-of-range RTP timestamps and sequence numbers。如果要 reject,回 481 Call/Transaction Does Not Exist。

如果 remote sequence number 是空的,設為 CSeq 序號。如果 remote sequence number 大於 CSeq 序號,the request is out of order and MUST 回 500 Server Internal Error。如果 remote sequence number 小於 CSeq 序號 (包括差 1 以上),request is in order 並更新為 CSeq 序號。如果請求 proxy challenges,並不會送到 UAS。UAC 需要序號增加重送請求 with credentials,所以序號可能會有 gap。

當收到 target refresh request,如果有 Contact,必須用來取代 dialog 的 remote target URI。

12.3 Termination of a Dialog

建立 dialog 失敗,同時也結束 early dialog。結束 dialog 的機制是 method specific,例如 BYE 結束一個 INVITE 建立的 session 以及 associated dialog。

Call-ID 分大小寫,tag 不分大小寫

tag-param = "tag" EQUAL token

tag 值是 token,包含英文字母、數字和其他符號共 72 字元,不分大小寫的話 46 (會有設備去改大小寫嗎?)。

參考

  1. RFC 3261

沒有留言:

張貼留言

SIP header Via

所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...