Hi community,
I have issue regarding using sip server in C# to answer the call that has been supervised by party and send to my device.
During the development phase we were using your RingCentral phone (windows) application, to automatically register device and answer the calls, that were supervised by party. During testing phase we notice that phone application is add calls on hold if there are simultaneous. So we develop and active SIP Server that will register our device and respond to the SIP messages.
Issue:
We successfully registering extension programmatically in code. After every call, we supervise by party and receive event “INVITE”, on which we are trying to respond with “TRYING” and “200OK (SDP)”, in order to answer the call and receive the RTP data. After send 200OK on the INVITE we receive this error:
"errorCode" : "TAS-119",
"message" : "Can't reach deviceId specified in request".
Our registered device is online after registration.
Can you provide me more information what we’re doing wrong or any suggestion how to continue. In attachments I have add the Wireshark trace from the network and the error description that we receive after super-vise by party.
Code flow:
- Making CreateSipRegistrationRequest
CreateSipRegistrationRequest createSipRegistrationRequest = new CreateSipRegistrationRequest
      {
        sipInfo = new ] { new SIPInfoRequest { transport = "TCP" }, },
        device = new DeviceInfoRequest()
        {
          computerName = Environment.MachineName
        }
      };
      CreateSipRegistrationResponse response = Client.Restapi().ClientInfo().SipProvision().Post(createSipRegistrationRequest).Result;
- With received response (SipInfoResponse), we connect our TcpClient to the specif IP and port
- After successful connection from our TcpClient we send REGISTER sip message
- We are receiving TRYING and 401 Unauthorized with specific nonce,
- With that specific nonce from 401 message, we are creating authorization header and send REGISTER sip message again, on which we are receiving 200 OK.
- On this way we register our device.
After this we are trying to make test call, and supervise the call. On create call with RingCentral phone, we are receiving events for the call event, after answer the call from the other side, we try to super-vise the call.
We are supervising the call with specific code:
PartySuperviseRequest superviseCallSessionRequest = new PartySuperviseRequest
            {
              mode = LISTEN_MODE,
              supervisorDeviceId = DeviceId,
              agentExtensionId = !string.IsNullOrEmpty(message.ExtensionId) ? message.ExtensionId : !string.IsNullOrEmpty(message.FromExtension) ? message.FromExtension : message.ToExtension,
            };
            var account = Client.Restapi().Account().Get().Result;
            var result = Client.Restapi().Account(account.id.ToString()).Telephony().Sessions(message.TelephoneSessionId).Parties(partyId).Supervise().Post(superviseCallSessionRequest).Result;
After this call, we receive sip INVITE on our extension set for supervise. We have the network in the wireshark trace bellow. On this INVITE we are trying to send 200 OK in order to answer the call. After sending this 200OK, we recive the specific error:
StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
 Connection: keep-alive
 X-Rate-Limit-Group: light
 X-Rate-Limit-Limit: 50
 X-Rate-Limit-Remaining: 49
 X-Rate-Limit-Window: 60
 RoutingKey: SJC12P01
 RCRequestId: e0b62fec-386d-11eb-ba42-005056bb86e2
 Date: Mon, 07 Dec 2020 09:23:39 GMT
 Server: nginx
 Content-Length: 140
 Content-Type: application/json
}
Content: {
  "errors" :
   {
     "errorCode" : "TAS-119",
     "message" : "Can't reach deviceId specified in request"
   }
  ]
}
If we are doing the supervise with active RingCentral phone (windiows) application, it's working fine, because the answering of the call is done from the RingCentral Phone application. In order to support multiple simultaneous calls, we are trying to create active sip server.
I have Wireshark trace from the traffic during registration and answer of the call.
Wireshark Trace
https://drive.google.com/file/d/1Q0dVG6m-25gPNSVSpxWoRK_YgmMx0OUO/view?usp=sharing
Response from supervise by party
https://drive.google.com/file/d/1AlVtn3fwfoAOr3vIKOKpl7Dptyqc56H8/view?usp=sharing