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