SDP协议 学习笔记

来源:互联网 发布:c罗职业生涯数据 编辑:程序博客网 时间:2024/06/05 07:04
SDP:Session Description Protocol

SDP格式:
 
   Session description
       v=  (protocolversion)
       o=  (owner/creatorand session identifier)
       s=  (sessionname)
        i=* (sessioninformation)
        u=* (URI ofdescription)
        e=* (emailaddress)
        p=* (phonenumber)
        c=*(connection information - not required if included in allmedia)
        b=* (zero ormore bandwidth information lines)
        One or moretime descriptions ("t=" and "r=" lines, see below)
        z=* (timezone adjustments)
        k=*(encryption key)
        a=* (zero ormore session attribute lines)
        Zero or moremedia descriptions

     Time description
       t=  (time thesession is active)
        r=* (zero ormore repeat times)

     Media description, if present
       m=  (media nameand transport address)
        i=* (mediatitle)
        c=*(connection information - optional if included at
           session-level)
        b=* (zero ormore bandwidth information lines)
        k=*(encryption key)
        a=* (zero ormore 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任务创建计算机的地址。
   整个这个属性,是唯一表示一个任务。


e=123@126.com 或 p=+1 616555-6011
对于一个任务只能两者之中的一个,表示会议控制者的联系方式。邮件地址可以是[email]j.doe@example.com[/email](Jane Doe)形式,括号里面的是描述联系人的名称,或者Jane Doe<[email]j.doe@example.com[/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 IP4224.2.36.42/128,IP6没有这个TTL值。还允许象这样的<base multicastaddress>[/<ttl>]/<numberof addresses>格式的connection-address。如:c=IN IP4224.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 TimeProtocol),是以秒为单位,自从1900以来的时间。要转换为UNIX时间,减去2208988800。如果stop-time设置为0,则会话没有时间限制。如果start-time也设置为0,则会话被认为是永久的。


r=<repeat-interval><active duration><offsets fromstart-time>重复次数在时间表示里面可以如下表示:
     d - days (86400 seconds)
     h - hours (3600 seconds)
     m - minutes (60 seconds)
     s - seconds (allowed for completeness)
z=<adjustment time><offset> <adjustmenttime> <offset>....
k=<method>
k=<method>:<encryptionkey>
a=<attribute>
a=<attribute>:<value>
m=<media><port><proto><fmt> ...
m=<media><port>/<number ofports> <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 oftool>创建任务描述的工具的名称及版本号
a=ptime:<packettime>在一个包里面的以毫秒为单位的媒体长度
a=maxptime:<maximum packettime>以毫秒为单位,能够压缩进一个包的媒体量。
a=rtpmap:<payload type><encoding name>/<clockrate> [/<encoding  parameters>]
a=recvonly
a=sendrecv
a=sendonly
a=inactive,
a=orient:<orientation>其可能的值,"portrait","landscape" and "seascape" 。
a=type:<conferencetype>,建议值是,"broadcast", "meeting", "moderated","test" and "H332"。
a=charset:<character set>
a=sdplang:<languagetag>指定会话或者是媒体级别使用的语言
a=framerate:<framerate>设置最大视频帧速率
a=quality:<quality>值是0-10
a=fmtp:<format><format specific parameters>

在SIP协议的包含的内容是SDP时,应该把Content-Type设置成application/sdp。
1 0