question

venkatraju-p13839 avatar image
venkatraju-p13839 asked venkatraju-p13839 answered

I want live incoming call event in c# during phone ring.

I want integrate ringcentral with my window form. So i need to find caller number and name during phone ring from c#. So is there any possible solutions?

sdk
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 answered
Are you using the RingCentral SDK for c-sharp? If not, open your project and install the RingCentral SDK via NuGet (search for RingCentral Client 3.0.0 package).

After adding the SDK to your project, you can use it as shown below:

using RingCentral; 

...
const string RC_CLIENTID = "your app client id";
const string RC_CLIENTSECRET = "your app client secret;
const string RC_SERVER = " https://platform.devtest.ringcentral.com";

const string RC_USERNAME = "username";
const string RC_PASSWORD = "password";
const string RC_EXTENSION = "extension number"; 

RestClient rc = null;
SubscriptionService subscription = null;
...
        protected void Page_Load(object sender, EventArgs args)
        {
            if (rc == null)
            {
                rc = new RestClient(RC_CLIENTID, RC_CLIENTSECRET, false);
                RegisterAsyncTask(new PageAsyncTask(RingCentralAuthenticationAsync));
            }
        }

        private async Task RingCentralAuthenticationAsync()
        {
            await rc.Authorize(RC_USERNAME, RC_EXTENSION, RC_PASSWORD);
            if (rc.token.access_token.Length > 0)
            {
                Console.WriteLine("Authorized");
                RegisterAsyncTask(new PageAsyncTask(subscribeForNotification));
            }
        }   

        private async Task subscribeForNotification()
        {
            subscription = rc.Restapi().Subscription().New();
            subscription.EventFilters.Add("/restapi/v1.0/account/~/extension/~/incoming-call-pickup");
            subscription.NotificationEvent += (sender, args) =>
            {

                var message = args.message;
                Console.WriteLine(message);

            };

            subscription.StatusEvent += (sender, args) =>
            {

                Console.WriteLine(args.Message);
            };
            await subscription.Register();
        } 

Check out other notification type. Particularly the "Presence" would give you better telephony status.

Hope this helps!

+ Phong
1 |3000

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

venkatraju-p13839 avatar image
venkatraju-p13839 answered
Hi,

We implemented as you mentioned before. 

But main aim is :

I have installed ringcentral windows client . When call comes to my number i want find incoming call event in c# and want to place my stuff in that event and i want operate phone from screen(answer call, end call).And also i want know ring central supports TAPI?


1 |3000

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

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