2016年7月23日 星期六

SIP REGISTER

SIP 註冊 [RFC3261 §10]

SIP 用戶在網域 (domain) 中有個帳號「user@domain」,稱為 address-of-record,但連結到用戶實際所在的位址 (binding) 是可以變動的,可透過 SIP REGISTER 請求向 registrar 登記目前的位址。

registrar 專指接受並回覆 SIP REGISTER 請求的 UAS,在其管理的網域維護 binding 對應表,讓其它用戶要建立通話時可透過 proxy server 或 redirect server 查詢。

                                              bob
                                            +----+
                                            | UA |
                                            |    |
                                            +----+
                                               |
                                               |3)INVITE
                                               |   carol@chicago.com
      chicago.com        +--------+            V
      +---------+ 2)Store|Location|4)Query +-----+
      |Registrar|=======>| Service|<=======|Proxy|sip.chicago.com
      +---------+        +--------+=======>+-----+
            A                      5)Resp      |
            |                                  |
            |                                  |
  1)REGISTER|                                  |
            |                                  |
         +----+                                |
         | UA |<-------------------------------+
cube2214a|    |                            6)INVITE
         +----+                    carol@cube2214a.chicago.com
          carol

SIP REGISTER 可進行的動作包括建立 (create)、新增 (add)、更新效期 (refresh)、詢問 (query)、移除 (delete)、及修改 (modify)。每個用戶可有多個位址,可能是多個 UAC 註冊的不同位址,或者是不同情況使用的位址。每個位址都有效期限,到期前需要更新效期才能持續使用。效期設為 0 將位址移除,之後可再新增來達到修改的目的。

REGISTER 請求
  • Request-URI (必要):domain,例如 "sip:chicago.com",不能有 "userinfo" 及 "@"。
  • To (必要):要建立、詢問、或修改的 address-of-record,包含有 user name。
  • From (必要):負責註冊者的 address-of-record,通常跟 To: 一致,或者由第三方註冊。
  • Call-ID 及 CSeq (必要):對特定 registrar,UAC 每次開機後應該使用相同的 Call-ID,搭配 CSeq 每次請求加一,依此 registrar 可以偵測出沒按照順序到達的 REGISTER 請求。(反之,如果 Call-ID 不同便無法偵測順序是否正確)
  • Contact (may): 要登記連結的位址 (address bindings),可有多個,可以是 sip:、tel:、mailto: 等。可加 q 參數作為偏好使用。沒此項欄位時用來詢問。
  • Contact 各自的 expires 參數、或 Expires (may):到期秒數,註冊時可建議,但最終由 registar 決定。大於 232-1 (4294967295 秒或 136 年) 可視為 232-1,Malformed 值應該視為 3600。0 表示移除,此時 Contact 可用 * 移除所有位址連結。
  • Route (may)
  • Record-Route (有可能會有,但忽略):因為不會建立 dialog,所以沒效用。
  • Contact 的 action 參數:來自 RFC 2543,deprecated,不該使用。
動作ContactExpire
建立特定位址建議值
新增特定位址建議值
更新效期特定位址建議值
詢問不需要
移除特定位址,或 * 表全部。0
修改特定位址建議值

registrar response:

  • 2xx 的 Contact 會列出所有的 binding。註冊成功的 UA 找出自己那一項,根據其 expires 參數或 Expires 欄位值計算並更新有效期限。
  • Date: 用來設定時間。
  • 423 (Interval Too Brief) 的 Min-Expires:可使用等於或大於 Min-Expires 的 expires 值重新嘗試註冊。
  • 501 Not Implemented:不支援單純詢問。
  • 不能產生 6xx,不能有 Record-Route。

registrar 位址除了使用設定外,也可以用 domain 位址 DNS 取得,或 well-known "all SIP servers" 的 multicast 位址 "sip.mcast.net" (IPv4 是 224.0.1.75,IPv6 ?)。但使用 multicast 只是讓 registrar 知道位置,不會有回應 (為什麼?)。

參考

  • From TS 24.229:Unless either the user or the application within the UE has determined that a continued registration is not required the UE shall reregister an already registered public user identity either 600 seconds before the expiration time if the previous registration was for greater than 1200 seconds, or when half of the time has expired if the previous registration was for 1200 seconds or less, or when the UE intends to update its capabilities according to RFC 3840 [62] or when the UE needs to modify the ICSI values that the UE intends to use in a g.3gpp.icsi-ref media feature tag or IARI values that the UE intends to use in the g.3gpp.iari-ref media feature tag.
  • M. Schooler, "A multicast user directory service for synchronous rendezvous," Master's Thesis CS-TR-96-18, Department of Computer Science, California Institute of Technology, Pasadena, California, Aug. 1996.

沒有留言:

張貼留言

SIP header Via

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