Notification is not coming up in C#

  • 1
  • Question
  • Updated 2 years ago
I am able to register the sandbox account using the C#. I can also able to send the SMS messages through my C# API. However for the incoming call events, Incoming SMS events the notification is not raising.

sample code below:

sdk = new SDK(appKey, appSecret, SDK.Server.Sandbox, "CMC CTI Test", "");
var platform = sdk.Platform;
sdk.Platform.Login(phoneNumber, "", password, false);
 sub = sdk.CreateSubscription();

sub.NotificationEvent += (sender, e) =>                 {
                     Console.WriteLine(e.Message);
                 };
                 sub.Register();
Photo of Z Admin

Z Admin

  • 440 Points 250 badge 2x thumb

Posted 2 years ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
Are you using the latest version of the C# SDK from Github? https://github.com/ringcentral/ringcentral-csharp-client

Looking at your sample code, I do not see where you've added the event filters, and it appears you may be on an older or unofficial version of the RingCentral C# SDK.

Here is the code sample provided in the README.md for Subscriptions which appears slightly different from yours:

var subscription = rc.Restapi().Subscription().New();
subscription.EventFilters.Add("/restapi/v1.0/account/~/extension/~/message-store");
subscription.EventFilters.Add("/restapi/v1.0/account/~/extension/~/presence");
subscription.ConnectEvent += (sender, args) => {
Console.WriteLine("Connected:");
Console.WriteLine(args.Message);
};
subscription.NotificationEvent += (sender, args) => {
Console.WriteLine("Notification:");
Console.WriteLine(args.Message);
};
subscription.ErrorEvent += (sender, args) => {
Console.WriteLine("Error:");
Console.WriteLine(args.Message);
};
subscription.Register();
Photo of Z Admin

Z Admin

  • 440 Points 250 badge 2x thumb
Hi Benjamin,

Thank you for sharing the information. I have downloaded and verified that test applications and getting this below error on 

private RestClient rc; (Unable to resolve the symbol RestClient)

rc.Restapi().Subscription.New (Unable to resolve the symbol Restapi)

I was checking all references added properly and i downloaded the required packages from Nuget Manager.

Thanks.
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,642 Points 5k badge 2x thumb
This seems like an appropriate issue to post in the issue tracker in Github for the repository of the C# SDK: https://github.com/ringcentral/ringcentral-csharp-client/issues.
Photo of Tyler Long

Tyler Long, Official Rep

  • 8,152 Points 5k badge 2x thumb
Because you didn't add any event filters for sms and call events. Please check the sample code posted by Dean.

Notifications in sandbox don't work reliably, so even you add the event filters, you might still have issues.

We are moving away to GitHub and Stackoverflow so it's better for you to post your questions there.
(Edited)