Question

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

  • 1 February 2019
  • 2 replies
  • 1390 views

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?


2 replies

Userlevel 1
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
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?


Reply