0

在我的 VOIP 应用程序中,我正在向 (INVITEE_NUMBER) 发送邀请请求,并在被邀请者接听电话时获得 200 OK 响应,

但是当我发送再见请求以终止呼叫时,我从服务器收到 407 响应代码,我应该将其视为未经身份验证的响应还是我犯了一些错误。

请参考 SIP 流程,

向 INVITEE_NUMBER 发送 BYE 请求

BYE sip:INVITEE_NUMBER@SERVER_ADDRESS:PORT_NO SIP/2.0
Via: SIP/2.0/UDP SERVER_ADDRESS:PORT_NO;branch=z9hG4bKe474296b56f64451ba78152b5ecd2e6c;
To: <sip:INVITEE_NUMBER@SERVER_ADDRESS:PORT_NO>;tag=fe65e252-2245-3d98-cec9-31e2f05efe9d
From: "" <sip:MY_SIP_NO@SERVER_ADDRESS:PORT_NO>;tag=1193168134
Call-ID: 0401186002ac45deaebf746061ec29cc
CSeq: 3 BYE
Max-Forwards: 70
Route: <sip:SERVER_ADDRESS:PORT_NO;lr>
Content-Length: 0

来自服务器的响应

SIP/2.0 407 Proxy Authentication required
Via: SIP/2.0/UDP SERVER_ADDRESS:PORT_NO;branch=z9hG4bKe474296b56f64451ba78152b5ecd2e6c;rport=5061;received=124.40.244.4
To: <sip:INVITEE_NO@SERVER_ADDRESS:PORT_NO>;tag=fe65e252-2245-3d98-cec9-31e2f05efe9d
From: "" <sip:MY_NUMBER@SERVER_ADDRESS:PORT_NO>;tag=1193168134
Call-ID: 0401186002ac45deaebf746061ec29cc
CSeq: 3 BYE
Max-Forwards: 70
Proxy-Authenticate: Digest realm="vo.packet8.net",nonce="cf319a6e81ade8f6be8d658a6a0e86ca",qop=auth,opaque="",algorithm=MD5
Content-Length: 0

这是预期的,还是有问题或客户端或服务器端?

4

1 回答 1

2

理论上,接收用户代理可以挑战任何请求,包括 BYE。此外,请求路径上的任何有状态代理也可以挑战请求。在这两种情况下,客户端都必须使用其凭据重新提交请求。

There's nothing I could find in the SIP RFC that deals specifically with authorisation of BYE requests but this quote from "12.2.2 UAS Behavior" does indicate that in-dialog requests do need to support authorisation:

If a proxy challenges a request generated by the UAC, the UAC has to resubmit the request with credentials. The resubmitted request will have a new CSeq number. The UAS will never see the first request, and thus, it will notice a gap in the CSeq number space. Such a gap does not represent any error condition.

That being said it's very unusual for a BYE request to be challenged and I suspect there are a lot of SIP stacks around that would not handle it correctly. As Frank has intimated I'd be inclined to check the request routing by looking at the Record-Route headers on the OK response and make sure you are sending the BYE to the correct destination.

于 2012-12-29T09:32:39.160 回答