question

Petre Dimov avatar image
Petre Dimov asked TFOMIA RCDevUser commented

Issue answer (200OK) on INVITE on supervise by party

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

errors
1 comment
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ commented ·

Can you explain more about this part?

"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."


How did it "automatically register device and answer the calls"? What is "supervised by party"? Does the "add calls on hold ..." have anything to do with this? Did it work w/o putting a call on hold? And "active SIP server ..."

0 Likes 0 ·
TFOMIA RCDevUser avatar image
TFOMIA RCDevUser answered TFOMIA RCDevUser commented

We are also trying to implement the SIP phone in .net core. We have registered out Existing Phone (SIP Phone) in service.devtest.ringcentral.com portal. After registration we got the device id that we are trying to use to supervise the call using that SIP Phone. But whenever we hit the https://platform.devtest.ringcentral.com/restapi/v1.0/account/accountId/telephony/sessions/telephonySessionId/supervise api we are getting the same error mentioned in this article "Can't reach deviceId specified in request". Also, we have checked the status of Existing Phone and it is showing as Online. Could you please help to resolve this issue.

2 comments
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Tyler Liu avatar image Tyler Liu ♦ commented ·

Are you following this guide https://medium.com/ringcentral-developers/use-sip-over-tcp-and-rtp-to-create-a-ringcentral-device-55a7416452b6?

As far as I can tell, that is the only working demo for SIP in .NET for RingCentral services.

0 Likes 0 ·
TFOMIA RCDevUser avatar image TFOMIA RCDevUser Tyler Liu ♦ commented ·

Thanks @Tyler Liu for you reply..
We are also following the same article that you shared. However, after getting the invitation message we are not able to get packets of audio stream. We are not getting output Console.WriteLine("OnRtpPacketReceived"). and it prints the AKG message on to the console. Please let us know if we need to update any config or code.

0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys