SDP 消息格式

SDP 消息格式

SIP 協議詳解 中提到過一種Sip body消息體格式message/sdp,這一節來了解一下SDP消息格式。

  • SDP(Session Description Protocol)是一種會話描述的數據格式
    RFC4566 中有這樣一斷描述:
    SDP is purely a format for session description -- it does not incorporate a transport protocol, and it is intended to use different transport protocols as appropriate, including the SAP(Session Announcement Protocol) ,SIP(Session Initiation Protocol) , RTSP(Real Time Streaming Protocol) ,electronic mail using the MIME extensions, and the Hypertext Transport Protocol.
    翻譯過來大概是:
    SDP(Session Description Protocol)是一種純粹的會話描述的格式。 SDP不是傳輸協議,信息傳輸上,其適當使用不用協議完成,包括:SAP,SIP,RTSP,HTTP,MIME協議擴展。
  • SDP 通常用在會話初始化過程中,用來傳送會話參與者的能力列表,以協調會話雙方的各項參數。例如:媒體的種類爲 audio 或 video ;媒體的編碼方式(H.261 video、MPEG video 等) 。

SDP舉例:

Session description
   v=0
   o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
   s=SDP Seminar
   i=A Seminar on the session description protocol
   u=http://www.example.com/seminars/sdp.pdf
   [email protected] (Jane Doe)
   c=IN IP4 224.2.17.12/127
   t=2873397496 2873404696
   a=recvonly
   m=audio 49170 RTP/AVP 0
   m=video 51372 RTP/AVP 99
   a=rtpmap:99 h263-1998/90000

Time description
   t=3034423619 3042462419
   r=604800 3600 0 90000

Media description
   m=video 49170/2 RTP/AVP 31

SDP協議的結構如下:

Session description
   v=  (protocol version)
   o=  (originator 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)

Session description

Type 含義 解釋 舉例
v protocol version SDP的版本號 v=0
o origion 會話發起者的描述 o={用戶名}{session id} {會話版本} {網絡類型}{地址類型}{地址}
s Session Name 會話名,在整個會話中有且只有一個”s=” s=SDP Seminar
i session information 會話的文本描述信息 i=A Seminar on the session description protocol
u URI The URI should be a pointer to additional information about the session. u=http://www.example.com/seminars/sdp.pdf
e Email Address and Phone Number specify contact information for the person responsible for the conference [email protected] (Jane Doe)
c Connection Data the connection type and address c=IN IP4 224.2.17.12/127
b Bandwidth the proposed bandwidth to be used by thesession or media c=IN IP4 224.2.17.12/127

Time description

Type 含義 解釋 舉例
t Timing specify the start and stop times for a session t={開始時間} {結束時間}
r Repeat Times specify repeat times for a session r={重複間隔}{活動時長}{啓動時間偏移}

Media description

Type 含義 解釋 舉例
m media name and transport address m={media}{port}{proto}{fmt} m=video 49170/2 RTP/AVP 31

參考

RFC4566:https://tools.ietf.org/html/rfc4566

SDP協議介紹:https://www.cnblogs.com/idignew/p/7249056.html

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