question

Juneeight gull avatar image
Juneeight gull asked Tyler Liu commented

How to phone number track with c# SDK?

I need to develop an application to Track live call numbers when the RingCentral phone app is ringing. How can I do that with C# SDK?




#User story#


We have developed a c#, .net windows-based application for the Pizza shop. They need to integrate their RingCentral app with this new application to track customer call numbers. When ringing the RingCentral phone app, We need to get the customer's phone number and check whether that number is already registered with our DB. Could please help in order to get this done? I am looking for a sample code.

internet explorer
1 |3000

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

Juneeight gull avatar image
Juneeight gull answered Tyler Liu commented

I tried with the below code and got the error.

// https://developers.ringcentral.com/my-account.html#/applications // Find your credentials at the above url, set them as environment variables, or enter them below


RestClient rc = new RestClient( Environment.GetEnvironmentVariable("clientId"), Environment.GetEnvironmentVariable("clientSecret"), false );

await rc.Authorize( Environment.GetEnvironmentVariable("username"), Environment.GetEnvironmentVariable("extension"), Environment.GetEnvironmentVariable("password") );

var r = await rc.Restapi().ClientInfo().SipProvision().Post(); // PROCESS RESPONSE


-----------------------------------------------------


{ "errorCode": "SPR-112", "message": "Client edition is not compatible with current Brand", "errors": [ { "errorCode": "SPR-112", "message": "Client edition is not compatible with current Brand" } ] }

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.

Why did you invoke await rc.Restapi().ClientInfo().SipProvision().Post()?

It's for low level SIP and it's probably not what you need.


To get customer phone number, when they call you, you need to create a subscription: https://github.com/ringcentral/RingCentral.Net/blob/master/RingCentral.Tests/SubscriptionTest.cs

And here is the event: https://developers.ringcentral.com/api-reference/Extension-Telephony-Sessions-Event


0 Likes 0 ·
Juneeight gull avatar image
Juneeight gull answered Tyler Liu commented

Hi Tyler,


I checked your sample. But I received the below error. Could you please advise how can I get this off?

1656093750257.png


Also, I have given all the permissions.


1656093813917.png


Here is my code snippet


1656093896741.png


1656093750257.png (37.1 KiB)
1656093813917.png (34.1 KiB)
1656093896741.png (136.6 KiB)
7 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.

it means you authorize your app using extension 1, and try to subscribe to events for extensions 2. But extension 1 and extension 2 don't belong to the same company.

0 Likes 0 ·
Juneeight gull avatar image Juneeight gull Tyler Liu ♦ ·

I tried with the below event URL. Could you please let me know, what are the correct values for the accountId & extensionId parameters? I just use my sandbox user name and extension. If those are wrong where can I find the correct details?

"/restapi/v1.0/account/{accountId}/extension/{extensionId}/telephony/sessions"


1656097276678.png


Also, I used the same credentials, clientId & secret for the RestClient constructor & Authorize.

0 Likes 0 ·
1656097276678.png (28.9 KiB)
Tyler Liu avatar image Tyler Liu ♦ Juneeight gull ·

Make an API call to /restapi/v1.0/account/~/extension

to get all the extensions, where you can find the extension Ids. If you only need the ID for the current extension, use "~" as ID.

1 Like 1 ·
Show more comments
Juneeight gull avatar image
Juneeight gull answered Juneeight gull commented

Also, your sample is for Send SMS, Not to Get caller number. It would be great if you can share a sample code that I can use to get the call number when ringing the phone.



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

Code is almost the same. You just replace the event filter. And parse the response for the number.

0 Likes 0 ·
Juneeight gull avatar image Juneeight gull Tyler Liu ♦ ·

I m not clear with this? How/Where can I do this?

And parse the response for the number.

0 Likes 0 ·
Tyler Liu avatar image Tyler Liu ♦ Juneeight gull ·

I see you are already doing the right thing in your code.

0 Likes 0 ·
Show more comments

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