SIP是怎样协商音频编码的?
大家好,
这是我用Wirelshark抓到的SIP邀请包和应答包:
No. Time Source Destination Protocol Info
5 2011-11-25 11:31:46.009850 xxx.xxx.xxx.xxx 192.168.1.105 SIP/SDP Request: INVITE sip:90070048@xxx.xxx.xxx.xxx:25922;transport=UDP, with session description
Session Initiation Protocol
Request-Line: INVITE sip:90070048@xxx.xxx.xxx.xxx:25922;transport=UDP SIP/2.0
Message Header
From: "7dmofedhjpev2h1ta9hdrj6gg8t"<sip:7dmofedhjpev2h1ta9hdxxx.xxx.xxx.xxx@192.168.8.20>;tag=5608328-1408a8c0-13c4-2831b8-628cd8c9-2831b8
To: <sip:90070048@xxx.xxx.xxx.xxx:25922;transport=UDP>
Call-ID: 56aedd8-1408a8c0-13c4-2831b8-1fdfb3b1-2831b8@192.168.8.20
CSeq: 1 INVITE
Via: SIP/2.0/UDP 192.168.8.20:5060;rport;branch=z9hG4bK-2831b8-9d023880-355ecae7
Allow: INVITE,ACK,OPTIONS,REGISTER,INFO,REFER,SUBSCRIBE,NOTIFY,BYE
User-Agent: DonJin SIP Server 2.2.0
Max-Forwards: 70
Contact: <sip:7dmofedhjpev2h1ta9hdxxx.xxx.xxx.xxx@xxx.xxx.xxx.xxx>
Content-Type: application/SDP
Content-Length: 300
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): DJXMS 0 0 IN IP4 192.168.8.20
Session Name (s): DJXMS
Connection Information (c): IN IP4 xxx.xxx.xxx.xxx
Bandwidth Information (b): CT:1000
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 10216 RTP/AVP 18 0 8 4 96 98 99
Media Attribute (a): rtpmap:18 G729/8000
Media Attribute (a): rtpmap:0 PCMU/8000
Media Attribute (a): rtpmap:8 PCMA/8000
Media Attribute (a): rtpmap:4 G723/8000
Media Attribute (a): rtpmap:96 AMR/8000
Media Attribute (a): rtpmap:98 telephone-event/8000
Media Attribute (a): fmtp:98 0-15
Media Attribute (a): rtpmap:99 tone/8000
No. Time Source Destination Protocol Info
9 2011-11-25 11:31:46.108437 192.168.1.105 xxx.xxx.xxx.xxx SIP/SDP Status: 200 OK, with session description
Session Initiation Protocol
Status-Line: SIP/2.0 200 OK
Message Header
Via: SIP/2.0/UDP 192.168.8.20:5060;rport=5060;branch=z9hG4bK-2831b8-9d023880-355ecae7;received=xxx.xxx.xxx.xxx
From: "7dmofedhjpev2h1ta9hdrj6gg8t" <sip:7dmofedhjpev2h1ta9hdxxx.xxx.xxx.xxx@192.168.8.20>;tag=5608328-1408a8c0-13c4-2831b8-628cd8c9-2831b8
To: <sip:90070048@xxx.xxx.xxx.xxx:25922;transport=UDP>;tag=2083651544
Call-ID: 56aedd8-1408a8c0-13c4-2831b8-1fdfb3b1-2831b8@192.168.8.20
CSeq: 1 INVITE
Contact: <sip:90070048@192.168.1.105:25922>
Content-Type: application/sdp
User-Agent: CD.JUNCTION.ECC/V1.02 20101010 (linphone/1.0.0)
Content-Length: 205
Message Body
Session Description Protocol
Session Description Protocol Version (v): 0
Owner/Creator, Session Id (o): toto 123456 654321 IN IP4 192.168.1.105
Session Name (s): A conversation
Connection Information (c): IN IP4 192.168.1.105
Time Description, active time (t): 0 0
Media Description, name and address (m): audio 32013 RTP/AVP 0 8 98
Media Attribute (a): rtpmap:0 PCMU/8000
Media Attribute (a): rtpmap:8 PCMA/8000
Media Attribute (a): rtpmap:98 telephone-event/8000
在Message Body部份,主叫表明了可以支持G729、PCMU、PCMA、G723、AMR等音频编码格式,被叫在应答中表明可以支持PCMU、PCMA和telephone-event,
请问主叫与被叫最终使用哪种编码?是怎样确定的?好像并没有说明使用哪一种啊?双方都提出几种格式,却没有地方表明两方的一致选择呢?还请各位解惑,谢谢
[解决办法]
一般会选择双方相同的第一个。就是0,PCMU
[解决办法]
请看 rfc3264
Offer Answer Model,这篇文档就是专门讲协调编码的
[解决办法]