我正在开发一个连接到 Asterisk 服务器并尝试拨打电话的 SIP 用户代理应用程序。我正在使用 JAIN SIP API 的 NIST 实现。
应用程序首先成功注册自己。然后,当应用程序向 X-Lite SIP 软电话发送 INVITE 请求时,Asterisk 会以 407(需要代理身份验证)响应进行响应。响应包含一个 Proxy-Authenticate 标头。我的应用程序再次发送 INVITE,但这次使用 Proxy-Authorization 标头,Asterisk 以 488 响应(此处不可接受)。
下面是 SIP 会话('>>' 表示传出消息;'<<' 表示传入消息):
>> REGISTER sip:10.0.84.30:5060 SIP/2.0
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Expires: 300
Content-Length: 0
<< SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
Content-Length: 0
<< SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK493cd4b63090dc9a8027931937b737c9353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>;tag=as4d134cc6
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 1 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
WWW-Authenticate: Digest realm="asterisk",nonce="27ca4a51"
Content-Length:0
>> REGISTER sip:10.0.84.30:5060 SIP/2.0
CSeq: 2 REGISTER
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Expires: 300
Authorization: Digest username="301",realm="asterisk",nonce="27ca4a51",response="cfdcdff7ddee99d10c3099e88ffb73af",algorithm=MD5,uri="sip:10.0.84.30:5060",nc=00000001
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
Content-Length: 0
<< SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 2 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:301@10.0.84.30>
Content-Length: 0
<< SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bKe339b4ed9edc5d75379673b6dec7fc42353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=0vmZig
To: <sip:301@asterisk>;tag=as4d134cc6
Call-ID: 7f2d15884ab375fc7b5d32fdd28426d5@10.0.85.3
CSeq: 2 REGISTER
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Expires: 300
Contact: <sip:10.0.85.3:5060>;expires=300
Date: Tue, 03 May 2011 09:37:45 GMT
Content-Length: 0
>> INVITE sip:302@asterisk SIP/2.0
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 3 INVITE
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6704cd9554c0c8e5bc94bc42b606147a353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Route: <sip:10.0.84.30:5060;lr>
Content-Type: application/sdp
Content-Length: 106
v=0
o=- 3513403599 3513403599 IN IP4 10.0.85.3
s=-
c=IN IP4 10.0.85.3
t=0 0
m=audio 40000 RTP/AVP 3
<< SIP/2.0 407 Proxy Authentication Required
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6704cd9554c0c8e5bc94bc42b606147a353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>;tag=as7358e1b8
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 3 INVITE
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:302@10.0.84.30>
Proxy-Authenticate: Digest realm="asterisk",nonce="55deefb6"
Content-Length: 0
>> INVITE sip:302@asterisk SIP/2.0
CSeq: 4 INVITE
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6e3501c0973664fcd7a17affddd23572353835 Max-Forwards: 70
Contact: <sip:10.0.85.3:5060>
Route: <sip:10.0.84.30:5060;lr>
Content-Type: application/sdp
Proxy-Authorization: Digest username="301",realm="asterisk",nonce="55deefb6",response="47e2c7abe625e4a183726e29c035d7e0",algorithm=MD5,uri="sip:302@asterisk",nc=00000001
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
Content-Length: 106
v=0
o=- 3513403599 3513403599 IN IP4 10.0.85.3
s=-
c=IN IP4 10.0.85.3
t=0 0
m=audio 40000 RTP/AVP 3
<< SIP/2.0 488 Not acceptable here
Via: SIP/2.0/UDP 10.0.85.3:5060;branch=z9hG4bK6e3501c0973664fcd7a17affddd23572353835;received=10.0.85.3
From: <sip:301@asterisk>;tag=sJSeLA
To: <sip:302@asterisk>;tag=as7358e1b8
Call-ID: 003d85b0d0868f6f2a2d8c324d7f1d54@10.0.85.3
CSeq: 4 INVITE
User-Agent: Asterisk PBX (switchvox)
Allow: INVITE,ACK,CANCEL,OPTIONS,BYE,REFER,SUBSCRIBE,NOTIFY
Contact: <sip:302@10.0.84.30>
Content-Length: 0
我在这里做错了什么,导致 488 响应?