SDP協議 學習筆記

                                                                                             SDP協議
SDP:Session Description Protocol

SDP格式:
      Session description
         v=  (protocol version)
         o=  (owner/creator and session identifier)
         s=  (session name)
         i=* (session information)
         u=* (URI of description)
         e=* (email address)
         p=* (phone number)
         c=* (connection information - not required if included in all media)
         b=* (zero or more bandwidth information lines)
         One or more time descriptions ("t=" and "r=" lines, see below)
         z=* (time zone adjustments)
         k=* (encryption key)
         a=* (zero or more session attribute lines)
         Zero or more media descriptions

      Time description
         t=  (time the session is active)
         r=* (zero or more repeat times)

      Media description, if present
         m=  (media name and transport address)
         i=* (media title)
         c=* (connection information - optional if included at
              session-level)
         b=* (zero or more bandwidth information lines)
         k=* (encryption key)
         a=* (zero or more media attribute lines)

以上帶"*"號的是可選的,其餘的是必須的。一般順序也按照上面的順序來排列。


a=*是sdp協議擴展屬性定義,除上面以外的,分解時其它的都可以扔掉。
a=charset屬性指定協議使用的字符集。一般的是ISO-10646。


示例:
v=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
   其中:nettype是IN,代表internet,addrtype是IP4或IP6。unicast-address任務創建計算機的地址。
   整個這個屬性,是唯一表示一個任務。


[email protected] 或 p=+1 616 555-6011
對於一個任務只能兩者之中的一個,表示會議控制者的聯繫方式。郵件地址可以是[email][email protected][/email] (Jane Doe)形式,括號裏面的是描述聯繫人的名稱,或者Jane Doe <[email][email protected][/email]>,前面的是聯繫人的名稱。


c=<nettype> <addrtype> <connection-address>
這個連接數據,可以是傳話級別的連接數據,或者是單獨一個媒體數據的連接數據。在是多播時,connection-address就該是一個多播組地址,當是單播時,connection-address就該是一個單播地址。對於addrtype是IP4的情況下,connection-address不僅包含IP地址,並且還要包含a time to live value(TTL 0-255),如:c=IN IP4 224.2.36.42/128,IP6沒有這個TTL值。還允許象這樣的<base multicast address>[/<ttl>]/<number of addresses>格式的connection-address。如:c=IN IP4 224.2.1.1/127/3等同於包含c=IN IP4 224.2.1.1/127, c=IN IP4 224.2.1.2/127, c=IN IP4 224.2.1.3/127三行內容。


b=<bwtype>:<bandwidth> bwtype可以是CT或AS,CT方式是設置整個會議的帶寬,AS是設置單個會話的帶寬。缺省帶寬是千比特每秒。
t=<start-time> <stop-time>,這個可以有行,指定多個不規則時間段,如果是規則的時間段,則r=屬性可以使用。start-time和stop-time都遵從NTP(Network Time Protocol),是以秒爲單位,自從1900以來的時間。要轉換爲UNIX時間,減去2208988800。如果stop-time設置爲0,則會話沒有時間限制。如果start-time也設置爲0,則會話被認爲是永久的。


r=<repeat-interval> <active duration> <offsets from start-time>重複次數在時間表示裏面可以如下表示:
      d - days (86400 seconds)
      h - hours (3600 seconds)
      m - minutes (60 seconds)
      s - seconds (allowed for completeness)
z=<adjustment time> <offset> <adjustment time> <offset> ....
k=<method>
k=<method>:<encryption key>
a=<attribute>
a=<attribute>:<value>
m=<media> <port> <proto> <fmt> ...
m=<media> <port>/<number of ports> <proto> <fmt> ...
其中:<media>可以是,"audio","video", "text", "application" and "message"。<port>是媒體傳送的端口號,它依賴於c=和<proto>。<proto> 可以是,udp,RTP/AVP和RTP/SAVP。


a=cat:<category>分類,根據分類接收者隔離相應的會話
a=keywds:<keywords>關鍵字,根據關鍵字隔離相應的會話
a=tool:<name and version of tool>創建任務描述的工具的名稱及版本號
a=ptime:<packet time>在一個包裏面的以毫秒爲單位的媒體長度
a=maxptime:<maximum packet time>以毫秒爲單位,能夠壓縮進一個包的媒體量。
a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding   parameters>]
a=recvonly
a=sendrecv
a=sendonly
a=inactive,
a=orient:<orientation>其可能的值,"portrait", "landscape" and "seascape" 。
a=type:<conference type>,建議值是,"broadcast", "meeting", "moderated", "test" and "H332"。
a=charset:<character set>
a=sdplang:<language tag>指定會話或者是媒體級別使用的語言
a=framerate:<frame rate>設置最大視頻幀速率
a=quality:<quality>值是0-10
a=fmtp:<format> <format specific parameters>

在SIP協議的包含的內容是SDP時,應該把Content-Type設置成application/sdp。
 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章