2024年2月10日 星期六

SIP MWI

RFC3842 SIP event package for MWI

Alice 訂閱 message-summary 狀態 1 天,馬上同步目前狀態。refresh 或停止訂閱也會同步目前狀態。Via 省略 for clarity。

  • Event 帶 event package 名稱「message-summary」。
  • Accept 帶 NOTIFY 批體使用的 MIME 格式是 application/simple-message-summary
SUBSCRIBE sip:alice@vmail.example.com SIP/2.0
To: <sip:alice@example.com>
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 03:55:06 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 4 SUBSCRIBE
Contact: <sip:alice@alice-phone.example.com>
Event: message-summary
Expires: 86400
Accept: application/simple-message-summary
Content-Length: 0

回應

SIP/2.0 200 OK
To: <sip:alice@example.com>;tag=4442
From: <sip:alice@example.com>;tag=78923
Date: Mon, 10 Jul 2000 03:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 4 SUBSCRIBE
Expires: 86400
Content-Length: 0

馬上同步目前狀態:2 new and 8 old [2 urgent] 語音留言

  • Event 帶 message-summary。
  • Subscription-State 是 active。
  • Content-Type: application/simple-message-summary 表示批體的格式。
NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 03:55:07 GMT
Call-Id: 1349882@alice-phone.example.com
CSeq: 20 NOTIFY
Contact: <sip:alice@vmail.example.com>
Event: message-summary
Subscription-State: active
Content-Type: application/simple-message-summary
Content-Length: 99

Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 2/8 (0/2)

批體的格式

message-summary = msg-status-line CRLF
                   [msg-account CRLF]
                   [*(msg-summary-line CRLF)]
                   [ *opt-msg-headers ]

msg-status-line  = "Messages-Waiting" HCOLON msg-status
msg-status = "yes" / "no"
msg-account = "Message-Account" HCOLON Account-URI
Account-URI = SIP-URI / SIPS-URI / absoluteURI

msg-summary-line = message-context-class HCOLON newmsgs SLASH oldmsgs
                [ LPAREN new-urgentmsgs SLASH old-urgentmsgs RPAREN ]

opt-msg-headers = CRLF 1*(extension-header CRLF) ;新訊息 heeaders

message-context-class 見 Section 6.2 of RFC 3458 [7].
newmsgs = msgcount
oldmsgs = msgcount
new-urgentmsgs = msgcount
old-urgentmsgs  = msgcount
msgcount = 1*DIGIT   ; MUST NOT exceed 2^32-1

新訊息通知。新訊息一些 headers appended。

NOTIFY sip:alice@alice-phone.example.com SIP/2.0
To: <sip:alice@example.com>;tag=78923
From: <sip:alice@example.com>;tag=4442
Date: Mon, 10 Jul 2000 04:28:53 GMT
Contact: <sip:alice@vmail.example.com>
Call-ID: 1349882@alice-phone.example.com
CSeq: 31 NOTIFY
Event: message-summary
Subscription-State: active
Content-Type: application/simple-message-summary
Content-Length: 503

Messages-Waiting: yes
Message-Account: sip:alice@vmail.example.com
Voice-Message: 4/8 (1/2)

To: <alice@atlanta.example.com>
From: <bob@biloxi.example.com>
Subject: carpool tomorrow?
Date: Sun, 09 Jul 2000 21:23:01 -0700
Priority: normal
Message-ID: 13784434989@vmail.example.com

To: <alice@example.com>
From: <cathy-the-bob@example.com>
Subject: HELP! at home ill, present for me please
Date: Sun, 09 Jul 2000 21:25:12 -0700
Priority: urgent
Message-ID: 13684434990@vmail.example.com

使用 Callee Capabilities 和 Caller Preferences 的範例。使用 callee capabilities,notifier 進行註冊,Contact 含有參數 methods 和 events。為了表明身份,可以加 actor="msg-taker"。

REGISTER sip:sip3-sj.example.com SIP/2.0
To: <sip:alice@example.com>
From: <sip:alice@example.com>;tag=4442
...
Contact: <sip:alice@vm13-sj.example.com>
 ;actor="msg-taker";methods="SUBSCRIBE"
 ;automata;events="message-summary"

SUBSCRIBE 可看到上述的 Contact 參數。

SUBSCRIBE sip:alice@example.com SIP/2.0
...
Accept: application/simple-message-summary
Event: message-summary
Accept-Contact: *;automata;actor="msg-taker"

2024年2月7日 星期三

Q.931 CALL PROCEEDING

Q.931 訊息是被叫送給主叫表示已經開始建立請求的呼叫,不再接受其它呼叫建立資訊。

什麼是 call establishment information (呼叫建立資訊)?

可有下列選擇性 IE

  • Channel identification:如果是回應 SETUP 的第一個訊息,在 network-to-user 是必要的,在 user-to-network 不接受 SETUP 的 B-channel 時是必要的。
  • Progress indicator:interworking 提供 in-band information/patterns。在 user-to-network if Annex K is implemented or in accordance with the procedures of 5.11.3 and 5.12.3.
  • Display (限 n → u):最長 34 或 82 octets。
  • Bearer capability:included when the procedures of 5.11 for bearer capability selection apply. When present, progress indication No. 5, interworking has occurred and has resulted in a telecommunication service change, shall also be present.
  • High layer compatibility:included when the procedures of 5.12 for high layer compatibility selection apply. When present, progress indication No. 5, interworking has occurred and has resulted in a telecommunication service change, shall also be present.

SIP interworking

  • 收到 CALL PROCEEDING (撥入都用 En bloc,全部撥號都在 SETUP,沒有撥號結束的問題。)
    • 忽略?
    • 送 183?會被誤認為陣鈴?如果 183 /wo SDP 呢?
  • 送 CALL PROCEEDIN
    • ALERTING 前,也就是收到 180 或 183 /w SDP?
    • 收到 183 /wo SDP?
    • 送 SIP INVITE 前?
    • 認為撥號結束?

參考

  1. Q.931 3.1.2

2024年2月2日 星期五

UTC GMT

GMT (Greenwich Mean Time,格林威治標準時間):原理是平均太陽日。英國倫敦的格林威治皇家天文台觀察一整年「過中天」的時間,得到平均一天的長度,再細分成時、分、秒等。這個時間概念 1884 年確立,並往歐陸其他國家擴散。1924 開始,每小時就會向全世界播報時間。

後來有更穩定的觀測太陽日的方法,而不一定要在格林威治天文台,稱為世界時 (Universal Time,UT),有三種版本,UT0 是原始的觀測結果計算值,UT1 則是修正了地球在長時間尺度下會產生的自轉軸漂移的影響,UT2 則是為了研究需求更多修正了季節性的影響。基本上 UT1 和 GMT 是一致的。

由於地球的自轉正在緩慢減速,導致平均太陽日會逐漸變長,GMT 的 1 秒會愈來愈久,會變動對度量衡而言並不適合。1967 國際度量衡大會把秒的定義改成銫原子固定震盪次數的時間 (原子鐘),依此計算時間與日期的系統稱作國際原子時 (International Atomic Time, TAI),和地球自轉脫節了。。

國際原子時有個問題是長久下來會超前 GMT 愈來愈多。以國際原子時為基準,選擇適當的時間加入閏秒,來和 GMT 時間對齊,叫做協調世界時 (Universal Time Coordinated,UTC)。由於 UTC 相關國際度量衡標準,目前所有的國際通訊系統,像是衛星、航空、GPS 等,都採用 UTC 時間。

參考

  1. https://pansci.asia/archives/84978

SIP header Via

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