Question

In my VOIP Application, i am sending Invite request to ( INVITEE_NUMBER ), and getting 200 OK Response when invitee picks up a call,

But when i send Bye request to terminate the call, i am getting 407 Response code from the server, Should i treat it as an Un-Authenticated Response or am i making some mistake.

Please refer the SIP Flow,

Sending BYE Request to INVITEE_NUMBER

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

Response from server

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

Is this expected, or there is something wrong or Client or Server side ?

Was it helpful?

Solution

In theory a receiving User Agent can challenge any request including a BYE. In addition any Stateful Proxy along the request path can also challenge the request. In both cases the client must re-submit the request with its credentials.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top