Session Initiation Protocol SIP Speaker Date 20080911 SIP

  • Slides: 53
Download presentation
網路電話 Session Initiation Protocol (SIP) Speaker: 王嘉裕 Date: 2008/09/11

網路電話 Session Initiation Protocol (SIP) Speaker: 王嘉裕 Date: 2008/09/11

SIP - Session Initiation Protocol • 前身 - MMUSIC (Multiparty Multimedia Session Control), Sep.

SIP - Session Initiation Protocol • 前身 - MMUSIC (Multiparty Multimedia Session Control), Sep. 1999 • 由IETF的SIP Working Group 發展 – 開始於 1995 – Proposed standard RFC 2543, February 1999 – New Version of SIP - RFC 3261, June 2002

SIP • A Signaling Protocol – Create, Modify, Terminate Multimedia Sessions • 使用 IP

SIP • A Signaling Protocol – Create, Modify, Terminate Multimedia Sessions • 使用 IP • Client / Server 架構 • 相似於 HTTP, SMTP – Uniform Resource Locator (URL) sip: bob@hit. edu. tw sip: +886424961356@hit. edu. tw 也可以是 tel: +886424961356 – Request and Response – 回應訊息

SIP藉由現成的 IETF 協定來提供 • SIP的訊息格式 (HTTP 1. 1) – RFC 2616 • 描述媒體的連線 –

SIP藉由現成的 IETF 協定來提供 • SIP的訊息格式 (HTTP 1. 1) – RFC 2616 • 描述媒體的連線 – (SDP) RFC 2327 • 媒體(RTP) – RFC 3550 and (RTSP) RFC 2326 • 定址方式 (URL) – RFC 1738 and (URI) RFC 2396 • 名稱解析和位置的移動性 – (DHCP) RFC 2131 and (DNS) RFCs 1034&1035 • 資料編碼方式 (MIME) – RFC 2045 • 安全 (TLS) – RFC 2246 – IPsec • RFC 2401&2406

SIP的封包格式 Version IHL DSCP ECN Identification IPv 4 的表頭 Time to Live Total Length

SIP的封包格式 Version IHL DSCP ECN Identification IPv 4 的表頭 Time to Live Total Length Flags Protocol Fragment Offset Header Checksum Source Address Destination Address UDP 8 個 Bytes的表頭 (這裡也可以是TCP或者 SCTP) Options Source Port Length Padding Destination Port Checksum SIP表頭 以US-ASCII文字為基礎, 變動長度 SIP訊息主體 也是變動長度, 視Message-Type的需要而存在 可以是任何形式的資料

Protocol Zoo Source: Henning Schulzrinne, http: //www. cs. columbia. edu/~hgs/internet/

Protocol Zoo Source: Henning Schulzrinne, http: //www. cs. columbia. edu/~hgs/internet/

SIP組成元件 Location Server Redirect Server Registrar Server Gateway PSTN User Agent Proxy Server PLMN

SIP組成元件 Location Server Redirect Server Registrar Server Gateway PSTN User Agent Proxy Server PLMN Gateway

SIP User Agents • User Agent (UA) – 用戶端 User Agent Client (UAC) •

SIP User Agents • User Agent (UA) – 用戶端 User Agent Client (UAC) • 送出 SIP 請求 – 伺服器端 User Agent Server (UAS) • 回應 SIP 請求 接受或拒絶 – User Agent = UAC + UAS UA 1 LAN A UA 2 UA 3 UA 4 LAN B

SIP訊息流程 Request Redirect Server Location Server Response Proxy Server User Agent Proxy Server Media

SIP訊息流程 Request Redirect Server Location Server Response Proxy Server User Agent Proxy Server Media Session User Agent

SIP Request methods • RFC 3261 – REGISTER – INVITE – ACK – BYE

SIP Request methods • RFC 3261 – REGISTER – INVITE – ACK – BYE – OPTIONS – CANCEL • 其它的RFC…

SIP Request methods – INFO (RFC 2976) – PRACK (RFC 3262) – SUBSCRIBE and

SIP Request methods – INFO (RFC 2976) – PRACK (RFC 3262) – SUBSCRIBE and NOTIFY (RFC 3265) – UPDATE (RFC 3311) – MESSAGE (RFC 3428) – REFER (RFC 3515) – PUBLISH (RFC 3903)

SIP Response 說明 範例 1 xx Informational – 代表請求已收到 100 Trying 180 Ringing 181

SIP Response 說明 範例 1 xx Informational – 代表請求已收到 100 Trying 180 Ringing 181 Call is Being Forwarded 183 Session Progressing 2 xx Success – 代表請求已被成功處理 200 OK 202 Acceptable Redirection – 代表重新導向 3 xx 4 xx 5 xx 300 Multiple Choices 301 Moved Permanently 302 Moved Temporarily 401 Unauthorized 406 Not Acceptable 407 Proxy Authentication Required 486 Busy Here 487 Request Terminated 488 Not Acceptable Here Client Error – 代表用互端錯誤 Server Error –代表伺服器端錯誤 6 xx Global Failure – 代表整體網路環境錯誤 502 Bad Gateway 503 Service Unavailable 600 Busy Everywhere 603 Decline

SIP • 連線過程 UAC Server UAS INVITE 100 Trying – 建立連線 – 通話 –

SIP • 連線過程 UAC Server UAS INVITE 100 Trying – 建立連線 – 通話 – 斷線 INVITE 100 Trying 180 Ringing 200 OK ACK Call Setup ACK Media Session BYE 200 OK 100 Trying 200 OK Call Teardown

SIP訊息 – 範例 SIP SDP INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP

SIP訊息 – 範例 SIP SDP INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142 v=0 o=Alice 2897654321 IN IP 4 10. 0. 0. 1 s=Phone Call c=IN IP 4 192. 168. 0. 1 t=0 0 m=audio 49170 RTP/AVP 0 a=rtpmap: 0 PCMU/8000

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy.

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers Method 即 命令 Request URI SIP 協定版本 INVITE sip: bob@zzz. edu SIP/2.

SIP Headers Method 即 命令 Request URI SIP 協定版本 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests中都是必要的欄位 所有經過的SIP設備都會被列在這裡 ‘branch’用來識別不同的連線分支 INVITE sip: bob@zzz. edu SIP/2. 0 Via:

SIP Headers 在所有 SIP Requests中都是必要的欄位 所有經過的SIP設備都會被列在這裡 ‘branch’用來識別不同的連線分支 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests之中除了INFO都是必要的欄位 最多可以被幾個Server轉傳 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2.

SIP Headers 在所有 SIP Requests之中除了INFO都是必要的欄位 最多可以被幾個Server轉傳 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0     目的地位址 Via: SIP/2.

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0     目的地位址 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0      來源位址      虛擬的隨機亂數 (當作是ID使用)

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0      來源位址      虛擬的隨機亂數 (當作是ID使用) Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests中都是必要的欄位 James Polk 20050503 INVITE sip: bob@zzz. edu SIP/2. 0

SIP Headers 在所有 SIP Requests中都是必要的欄位 James Polk 20050503 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds 在網域內獨一無二的識別碼 Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP

SIP Headers 在所有 SIP Requests中都是必要的欄位 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 遞增的序號 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers James Polk 20050503 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP

SIP Headers James Polk 20050503 INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 直接可以路由到來源位址的完整網域名稱或IP位址 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy.

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu 用來描述附加的訊息主體格式 (如果有的話) CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy.

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE 用來描述附加的訊息主體的內容長度 (Octets) Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy.

SIP Headers INVITE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/UDP pc 33. yyy. edu; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142

SDP的欄位 ü v= (protocol version) 例如: v=0 ü o= (owner/creator and session identifier) o=<username>

SDP的欄位 ü v= (protocol version) 例如: v=0 ü o= (owner/creator and session identifier) o=<username> <session id> <version> <network type> <address> Username 不可以含有空格 Session id 和version 建議使用Network Time Protocol (NTP)的時間 ü為必要欄位 戳記來確保值的唯一性 例如: o=john 2887654326 2887654307 IN IP 4 10. 1. 2. 3 ü s= (session name string) 例如: s=SDP Seminar ü t= (start time and stop time) 例如: t=2887654321 2887654310(通常設為 0)

SDP的欄位 ü m= (media name and transport address) m=<media> <port> <transport> <format list> m=<media>

SDP的欄位 ü m= (media name and transport address) m=<media> <port> <transport> <format list> m=<media> <port>/<number of ports> <transport> <format list> 例如: m=video 49170/2 RTP/AVP 0 u-law PCM, single channel, audio <media> sampled at 8 KHz "audio", "video", "application", "data" and "control“ <transport> • RTP/AVP - the IETF's Realtime Transport Protocol using the Audio/Video profile carried over UDP • UDP – RTP/AVP RFC 3551 • e= (email address) 例如: e=john@yyy. edu (John Doe) 或者 e=John Doe <john@yyy. edu> • p= (phone number) 例如: p=+886 -4 -2496 -1356 或者 p=+886 4 2496 1356

SDP的欄位 • c= (connection information) c=<network type> <address type> <connection address> 例如: c=IN IP

SDP的欄位 • c= (connection information) c=<network type> <address type> <connection address> 例如: c=IN IP 4 224. 2. 17. 12/127 通常這個連線位址是一個 class D的 IP 群播位址, <base multicast address>/<ttl>/<number of addresses> 例如: c=IN IP 4 224. 2. 1. 1/127/3 指的是多個c=IN IP 4 224. 2. 1. 1/127, c=IN IP 4 224. 2. 1. 2/127, c=IN IP 4 224. 2. 1. 3/127 如果這一個會議連線不是群播, 則它可以搭配額外的屬性 欄位決定是完整網域位址或單一IP位址等等

SDP的欄位 • • i= (session information) u= (URI of description) b= (bandwidth information) z=

SDP的欄位 • • i= (session information) u= (URI of description) b= (bandwidth information) z= (time zone adjustments) k= (encryption key) a= (zero or more session attribute lines) r= (zero or more repeat times)

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE sip: bob@192. 168. 10. 20

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE sip: bob@192. 168. 10. 20 SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. K 776 asdhds Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142 (Alice's SDP not shown)

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK SIP/2. 0 200

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. Knashds 8 ; received=10. 1. 3. 33 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: bob@192. 168. 10. 20> Content-Type: application/sdp Content-Length: 131 (Bob's SDP not shown)

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK sip: bob@192.

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK sip: bob@192. 168. 10. 20 SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu; branch=z 9 h. G 4 b. Knashds 8 Max-Forwards: 70 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 ACK Content-Length: 0

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established BYE sip: alice@pc 33. yyy. edu SIP/2. 0 Via: SIP/2. 0/TCP 10. 1. 3. 33; branch=z 9 h. G 4 b. Knashds 8 Max-Forwards: 70 From: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf To: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 231 BYE Content-Length: 0

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established

SIP Methods: INVITE, ACK and BYE Bob Alice INVITE 200 OK ACK Session Established BYE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP 192. 168. 10. 20 From: Alice <sip: alice@yyy. edu>; tag=1928301774 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 231 BYE Content-Length: 0

透過Proxy Server Alice SIP Proxy “server. zzz. edu” INVITE sip: bob@zzz. edu/TCP SIP/2. 0

透過Proxy Server Alice SIP Proxy “server. zzz. edu” INVITE sip: bob@zzz. edu/TCP SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. K 776 asdhds ; received=10. 1. 3. 33 Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142 (Alice's SDP not shown) Bob

透過Proxy Server Alice INVITE Via Header for zzz server Via Header for Alice’s phone

透過Proxy Server Alice INVITE Via Header for zzz server Via Header for Alice’s phone Max-Forwards decreases 1 Bob SIP Proxy “server. zzz. edu” INVITE sip: bob@192. 168. 10. 20/TCP SIP/2. 0 Via: SIP/2. 0/TCP server. zzz. edu ; branch=z 9 h. G 4 b. K 4 b 43 c 2 ff 8. 1 ; received=192. 168. 10. 1 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. K 776 asdhds ; received=10. 1. 3. 33 Max-Forwards: 69 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: alice@pc 33. yyy. edu> Content-Type: application/sdp Content-Length: 142 (Alice's SDP not shown)

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK SIP/2. 0

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP server. zzz. edu ; branch=z 9 h. G 4 b. K 4 b 43 c 2 ff 8. 1 ; received=192. 168. 10. 1 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. Knashds 8 ; received=10. 1. 3. 33 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: bob@192. 168. 10. 20> Content-Type: application/sdp Content-Length: 131 (Bob's SDP not shown) James Polk 20050503 Notice both Via headers

透過Proxy Server Alice Notice one Via header Bob SIP Proxy “server. zzz. edu” INVITE

透過Proxy Server Alice Notice one Via header Bob SIP Proxy “server. zzz. edu” INVITE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. Knashds 8 ; received=10. 1. 3. 33 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 INVITE Contact: <sip: bob@192. 168. 10. 20> Content-Type: application/sdp Content-Length: 131 (Bob's SDP not shown)

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK sip:

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK sip: bob@192. 168. 10. 20 SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. Knashds 8 Max-Forwards: 70 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 314159 ACK Content-Length: 0

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session Established

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session Established BYE sip: alice@pc 33. yyy. edu SIP/2. 0 Via: SIP/2. 0/TCP 10. 1. 3. 33; branch=z 9 h. G 4 b. Knashds 8 Max-Forwards: 70 From: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf To: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 231 BYE Content-Length: 0

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session

透過Proxy Server Alice Bob SIP Proxy “server. zzz. edu” INVITE 200 OK ACK Session Established BYE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP 192. 168. 10. 20 From: Alice <sip: alice@yyy. edu>; tag=1928301774 To: Bob <sip: bob@zzz. edu>; tag=a 6 c 85 cf Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 231 BYE Content-Length: 0

SIP Methods: REGISTER Alice SIP Registrar Server REGISTER sip: server. yyy. edu SIP/2. 0

SIP Methods: REGISTER Alice SIP Registrar Server REGISTER sip: server. yyy. edu SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 bk 2 l 55 n 1 To: Alice <sip: alice@yyy. edu> From: Alice <sip: alice@yyy. edu>; tag=283074 Call-ID: a 84 b 4 g 96 te 10@pc 33. yyy. edu CSeq: 31862 REGISTER Contact: <sip: alice@10. 1. 3. 33> Expires: 21600 Content-Length: 0 REGISTER – 註冊 • SIP URI 稱之為 Address of Record (AOR) • 把一個AOR和現在可以連繫 得上的實際位址對應連接在 一起 • 讓UA可以收到 SIP的訊息 • UAs可以利用下列方法向伺 服器註冊 – 手動設定 – Address-of-Record – Multicast [224. 0. 1. 75]

SIP Methods: REGISTER Alice SIP Registrar Server REGISTER 200 OK SIP/2. 0 200 OK

SIP Methods: REGISTER Alice SIP Registrar Server REGISTER 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 bk 2 l 55 n 1; received=10. 1. 3. 33 To: Alice <sip: alice@yyy. edu>; tag=a 6 c 85 e 3 From: Alice <sip: alice@yyy. edu>; tag=283074 Call-ID: a 84 b 4 g 96 te 10@pc 33. yyy. edu CSeq: 31862 REGISTER Contact: <sip: alice@pc 33. yyy. edu> Contact: <sip: alice@pda 01. yyy. edu> Expires: 3600 Contact-Length: 0 REGISTER 通常是需要經過密碼認證的 • 200 (OK) 回應包含一連串的 Contact • Expires Header 告知 UA註 冊的有效期限

Call Forking Bob’s Office Phone TE I V IN yyy. edu Alice INVITE zzz.

Call Forking Bob’s Office Phone TE I V IN yyy. edu Alice INVITE zzz. edu INVITE Bob’s IN VI Notebook TE 同時嚮,看哪一個先接! Bob’s Mobile phone

SIP Methods: MESSAGE (RFC 3428) Bob Alice MESSAGE • MESSAGE sip: bob@zzz. edu SIP/2.

SIP Methods: MESSAGE (RFC 3428) Bob Alice MESSAGE • MESSAGE sip: bob@zzz. edu SIP/2. 0 Via: SIP/2. 0/TCP pc 33. yyy. edu ; branch=z 9 h. G 4 b. K 776 asegma Max-Forwards: 70 To: Bob <sip: bob@zzz. edu> From: Alice <sip: alice@yyy. edu>; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 22756 MESSAGE Content-Type: text/plain Content-Disposition: render Content-Length: 37 Isn’t this a great presentation, Bob? – – – 以 近乎 即時的方式傳送 存在在 MIME的主體中 不會啓始新的 dialogs 訊息之間沒有任何關聯 不可以超過 1300 bytes

SIP Methods: MESSAGE (RFC 3428) Bob Alice MESSAGE 200 OK SIP/2. 0 200 OK

SIP Methods: MESSAGE (RFC 3428) Bob Alice MESSAGE 200 OK SIP/2. 0 200 OK Via: SIP/2. 0/TCP pc 33. yyy. edu; branch=z 9 h. G 4 b. Knashds 7; received=10. 1. 3. 33 To: sip: bob@zzz. edu>; tag=a 6 c 85 e 3 From: alice@yyy. edu ; tag=1928301774 Call-ID: a 84 b 4 c 76 e 66710@pc 33. yyy. edu CSeq: 22756 MESSAGE Content-Length: 0

參考文獻 • http: //www. cs. columbia. edu/sip/ • “Carrier Grade Voice Over IP” –

參考文獻 • http: //www. cs. columbia. edu/sip/ • “Carrier Grade Voice Over IP” – Daniel Collins – 出版社: Mc. Graw-Hill – ISBN 0071231552 – http: //catalogs. mhhe. com/mhhe/view. Product. Details. do? isbn=007 1406344