http://blog.csdn.net/ppcat_001/archive/2007/11/09/1876020.aspx
http://www.rfc-editor.org/rfc/rfc4566.txt
SDP: Session Description Protocol(会话描述协议)
(RFC2327)
1. 概述
SDP也是MMUSIC工作组的一个产品,在MBONE内容中用得很多。其目的就是在媒体会话中,传递媒体流信息,允许会话描述的接收者去参与会话。SDP基本上在internet上工作。他定义了绘画描述的统一格式,但并不定义多播地址的分配和SDP消息的传输,也不支持媒体编码方案的协商,这些功能均由下层传送协议完成.典型的会话传送协议包括:SAP(Session Announcement Protocol 会话公告协议),SIP,RTSP,HTTP,和使用MIME的E-Mail.(注意:对SAP只能包含一个会话描述,其它会话传诵协议的SDP可包含多个绘画描述)
SDP包括以下一些方面:
1) 会话的名称和目的
2) 会话存活时间
3) 包含在会话中的媒体信息,包括:
媒体类型(video, audio, etc)
传输协议(RTP/UDP/IP, H.320, etc)
媒体格式(H.261 video, MPEG video, etc)
多播或远端(单播)地址和端口
4) 为接收媒体而需的信息(addresses, ports, formats and so on)
5) 使用的带宽信息
6) 可信赖的接洽信息(Contact information)
2. 协议
Session description //格式及举例
v= (protocol version) //v=0
o= (owner/creator and session identifier). //o=<用户名><会话id><版本><网络类
//型><地址类型><地址>
//o=sname 1234567890 0987654321 IN
//IP4 126.15.64.3
s= (session name) //会话名
i=* (session information) //会话信息
u=* (URI of description) //u=http://www.zte.com.cn/staff/sdp.ps
e=* (email address) //[email protected](general text如:王生)
//或e=Mr. Wang<[email][email protected][/email]>
p=* (phone number) //p=+86-0755-26773000-7110(wang)
//or p=+1 617 253 6011
c=* (connection information -如已经包含在所有媒体中则该行不需要)
//c=<网络类型><地址信息><连接地址>
//多点会议包括TTL
//连接地址: <base multicast
//address>/<ttl>/<number of addresses>
//c=IN IP4 224.2.13.23/127
//c=IN IP4 224.2.1.1/127/3
b=* (bandwidth information) //b=<修改量(CT Conference Total
//IAS Application-specific Max)>:<带宽
//值(kb/s)>
//b=CT:120
One or more time descriptions (see below)
z=* (time zone adjustments) //时区调整
k=* (encryption key) //k=<方法>:<密钥>或k=<方法>
a=* (zero or more session attribute lines) //a=<属性> 或a=<属性>:<值>
Zero or more media descriptions (see below)
各行严格按顺序,其中:
时间描述:
t= (time the session is active) //<开始时间><结束时间>,单位秒,十
//进制NTP
//t=2873397468 2873404969
r=* (zero or more repeat times) //<重复时间><活动持续时间
//以开始时刻为参考的偏移列表>单位秒
//r=604800 3666 90000 或写成
//r=7d 1h 0 25h
媒体描述:
m= (media name and transport address) //m=<媒体><端口><传送><格式列表>
//m=audio 49170 RTP/AVP 0 3
//协议为RTP,剖面为AVP
//参考rtp-parameters.txt
i=* (media title媒体称呼) //
c=* (connection information – 如已经包含在会话级描述则为可选)
b=* (bandwidth information) //同c
k=* (encryption key) //会话级为摸认值,同c
a=* (zero or more media attribute lines) //两种形式:(也同c)(见后说明)
//a=<attribute>如:
// a=recvonly
//a=<attribute>:<value>
注:v,o,s,t,m为必须的,其他项为可选。
如果SDP语法分析器不能识别某一类型(Type),则整个描述丢失;
如果”a=”的某属性值不理解,则予以丢失
整个协议区分大小写
“=”两侧不允许有空格
会话级的描述就是媒体级描述的缺省值
所有均格式为<type>=<value>
[ "/" integer ]
;multicast addresses may be in the range
;224.0.0.0 to 239.255.255.255
ttl = decimal-uchar
start-time = time | "0"
stop-time = time | "0"
time = POS-DIGIT 9*(DIGIT)
;sufficient for 2 more centuries
repeat-interval = typed-time
typed-time = 1*(DIGIT) [fixed-len-time-unit]
fixed-len-time-unit = "d" | "h" | "m" | "s"
bwtype = 1*(alpha-numeric)
bandwidth = 1*(DIGIT)
username = safe
;pretty wide definition, but doesn't include space
email-address = email | email "(" email-safe ")" |
email-safe "<" email ">"
email = ;defined in RFC822
uri= ;defined in RFC1630
phone-number = phone | phone "(" email-safe ")" |
email-safe "<" phone ">"
phone = "+" POS-DIGIT 1*(space | "-" | DIGIT)
;there must be a space or hyphen between the
;international code and the rest of the number.
nettype = "IN"
;list to be extended
addrtype = "IP4" | "IP6"
;list to be extended
addr = FQDN | unicast-address
FQDN = 4*(alpha-numeric|"-"|".")
;fully qualified domain name as specified in RFC1035
unicast-address = IP4-address | IP6-address
IP4-address = b1 "." decimal-uchar "." decimal-uchar "." b4
b1 = decimal-uchar
;less than "224"; not "0" or "127"
b4 = decimal-uchar
;not "0"
IP6-address = ;to be defined
text = byte-string
;default is to interpret this as IS0-10646 UTF8
;ISO 8859-1 requires a "a=charset:ISO-8859-1"
;session-level attribute to be used
byte-string = 1*(0x01..0x09|0x0b|0x0c|0x0e..0xff)
;any byte except NUL, CR or LF
decimal-uchar = DIGIT
| POS-DIGIT DIGIT
| ("1" 2*(DIGIT))
| ("2" ("0"|"1"|"2"|"3"|"4") DIGIT)
| ("2" "5" ("0"|"1"|"2"|"3"|"4"|"5"))
integer = POS-DIGIT *(DIGIT)
alpha-numeric = ALPHA | DIGIT
DIGIT = "0" | POS-DIGIT
POS-DIGIT = "1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"
ALPHA = "a"|"b"|"c"|"d"|"e"|"f"|"g"|"h"|"i"|"j"|"k"|
"l"|"m"|"n"|"o "|"p"|"q"|"r"|"s"|"t"|"u"|"v"|
"w"|"x"|"y"|"z"|"A"|"B"|"C "|"D"|"E"|"F"|"G"|
"H"|"I"|"J"|"K"|"L"|"M"|"N"|"O"|"P"|" Q"|"R"|
"S"|"T"|"U"|"V"|"W"|"X"|"Y"|"Z"
email-safe = safe | space | tab
safe = alpha-numeric |
"'" | "'" | "-" | "." | "/" | ":" | "?" | """ |
"#" | "$" | "&" | "*" | ";" | "=" | "@" | "[" |
"]" | "^" | "_" | "`" | "{" | "|" | "}" | "+" |
"~" | "
space = %d32
tab = %d9
CRLF = %d13.10
常见的如下:
a=rtpmap:103 ISAC/16000
a=rtpmap:102 iLBC/8000
a=rtpmap:3 GSM/8000
a=rtpmap:106 telephone-event/8000
a=rtpmap:13 CN/8000
a=rtpmap:117 red/8000
a=rtpmap:18 G729a/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:2 G726-32/8000
a=rtpmap:4 G723/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:96 G726-40/8000
a=rtpmap:97 G726-24/8000
a=rtpmap:98 G726-16/8000
a=rtpmap:100 NSE/8000
a=rtpmap:101 telephone-event/8000
a=rtpmap:0 pcmu/8000
a=rtpmap:8 pcma/8000
a=rtpmap:3 gsm/8000
a=rtpmap:18 G729/8000
a=rtpmap:98 iLBC/8000
a=rtpmap:97 speex/8000
a=rtpmap:101 telephone-event/8000