How to get response codes in sip 0.20.0

178 views
Skip to first unread message

Sports highfive

unread,
Aug 6, 2021, 12:52:50 PM8/6/21
to SIP.js
Hi

up until now I was using sipjs api 0.15.10. I could use response variable to get response.statusCode from there, but in 0.20.0 it only ends and I get SIP.SessionState.Terminated, I'm not able to get exact response code (reason for call end). I couldn't find anything helpful from documentation either. Can you help me with this please?
Thanks
Waqar

Slavik Bialik

unread,
Aug 6, 2021, 12:57:50 PM8/6/21
to SIP.js
Hi,
It's easy, you just get the response using your callbacks, like: onAccept, onReject and etc.
If you remember that previous thing I helped you with (how to get some "X-" custom SIP header from the 200 OK response), so you just do it within this kind of callback:

var inviterInviteOptions: InviterInviteOptions = {
    requestDelegate: {
    onAccept(response: AckableIncomingResponseWithSession)
    {
       ....
       ....
       var callUUID = response.message.getHeader("X-UUID") || "";
       var statusCode = response.message.statusCode;
       ....
       ....
    },
    onReject(response: IncomingResponse) {
      var statusCode = response.message.statusCode;

Sports highfive

unread,
Aug 6, 2021, 1:06:56 PM8/6/21
to SIP.js
Thankyou. Gosh! I did use this. Thanks again
Reply all
Reply to author
Forward
0 new messages