【正文】
key) a=* (zero or more session attribute lines) Zero or more media descriptions (see below) Sdp語法 ? Time description ? t= (time the session is active) ? r=* (zero or more repeat times) ? Media description ? m= (media name and transport address) ? i=* (media title) ? c=* (connection information optional if included at sessionlevel) ? b=* (bandwidth information) ? k=* (encryption key) ? a=* (zero or more media attribute lines) 例子 v=0 版本是 0 o=mhandley 2890844526 2890842807 IN IP4 o=username session id version work type address typeaddress session id 取決于 NTP( Network Time Protocol) version is increased when a modification is made s=SDP Seminar //只能有一個 Session name i=A Seminar on the session description protocol 對于會話水平和媒體水平 , 都只能是一個 i. u= //可選的 , 允許有多個 URI (Mark Handley) p=+44171380777 // Emailamp。Phone,可多選 , 也可不選 。 +表示國家代碼 。 -表示號碼連接符 c=IN IP4 ? // c=work type address type connection address ? // IN stand for Inter //127 stand for TIME TO LIVE (range 0255) ? //3表示后面連接的地址生命期是 127 b=12345678:8 // b=modifier:bandwidthvalue。 可選項 ,modifier是帶寬的修飾語 , 帶寬值的單位是 kilobits/second t=2873397496 2873404696 // t=start time stop time 如果stop time 為零 , 則會話無效;如果 start time 為 0, 則永久有效 。 注意要寫上 start time 和 stop time, 以防止 防止意外 。 K= uri: // Encryption Keys k=method:encryption key // 到 URI指定的地址取密鑰 a=recvonly // a=attribute m=audio 49170 RTP/AVP 0 // 可多選 m=media port transport fmt list // AVP=audio/video profile // fmt list 參考下頁表 m=video 51372 RTP/AVP 31 Audio Encoding Payload type 1016 1 DVI4 5, 6 G721 2 G722 9 G728 15 GSM 3 L16 10, 11 LPC 7 MPA 14 PCMA 8 PCMU 0 Payload types for standard audio encoding 8 . 能力協(xié)商 ? 協(xié)商介紹 ? 協(xié)商例子 UA能力協(xié)商概述 ?主叫攜帶能力集 INVITE的消息體中帶有 UAC( 主叫)的能力集 ?被叫證實能力 UAS( 被叫)在從主叫的能力集中選擇一種,通過 200 OK消息返回 ?根據(jù)消息體中的 IP地址和端口號創(chuàng)建 RTP流 c=IN IP4 (例子參加案例分析之“基本呼叫”) ? 最簡單的呼叫 ? 經(jīng)過兩個 Proxy的呼叫 ? 呼叫轉(zhuǎn)移 INVITE c=IN IP4 m=audio 49170 RTP/AVP 0 3 200 OK c=IN IP4 m=audio 12345 RTP/AVP 3 John’s terminal rings ACK John Mary Port 12345 The response indicates that John’s terminal can receive GSM data, on port 12345 例子一:最簡單的呼叫 180 Ring GSM Stream 200 OK BYE 例子二:經(jīng)過兩個 Proxy的呼叫 例子三: 遇忙轉(zhuǎn)移 User A Proxy User B1 INVITE INVITE 100 Trying 468 Busy ACK INVITE 180 Ringing 180 Ringing 200 OK 200 OK ACK ACK Both way RTP voice BYE BYE 200 OK 200 OK 10. 測驗 1. SIP網(wǎng)絡的主要功能實體是什么? 2. SIP協(xié)議有什么請求消息? 3. SIP如何尋址? 4. 如何進行媒體協(xié)商? 5. 畫出經(jīng)過一個 Proxy Server的呼叫序列圖 11. SIP協(xié)議的實現(xiàn)方法入門 ? 概述 ? 封裝消息 ? 解析消息 ? 狀態(tài)機 實現(xiàn)方法概述 封裝消息 CallIDFromTo內(nèi)存對象EnCodeINVITECallIDFromTo字符串消息解析消息 CallIDFromTo內(nèi)存對象DeCodeStateCallIDFromTo字符串消息狀態(tài)機的實現(xiàn) 12. SIP的繼續(xù)學習方法 1. SIP協(xié)議原文( RFC2543) 2. SIP協(xié)議的擴展( RFC2976) 3. SIP的權(quán)威站點 1) 官方站點) 2) 最新應用) 3) 最新應用) 4) 免費源代碼組織) 5) SIP的哥倫比亞大學老家) Contact me when you are troubled with SIP. It is my pleasure to discuss with you! Kermit