question

mutahir-mehmood1102 avatar image
mutahir-mehmood1102 asked vyshakhbabji Deactivated commented

Having Issue When Using C# SDK and using Presence API

Hi everyone,


I am having an issue with C# sdk and Pubnub Presence api. I can subscribe to Presence but no data is being received when ring central phone changes its state. I have created an equivalent javascript application which subscribes with same sub key and channel and it gets the notifications whenever ring central phone changes its state (whenever agent goes in a call or a call ends or agent changes its state manually) but this is not happening for Asp.net C# application. Right now I am using sample application from github provided by Pubnub but it doesn't work


Note: all the communication is encrypted and I have specified the cipher key as well


Thanks

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.

benjamin-dean avatar image
benjamin-dean answered John Wang Deactivated commented
We are aware of these blocking issues which have been reported in the Github repository for the RingCentral C# SDK, and we are working on prioritizing this work to get our developers unblocked.

In the meantime, the RingCentral C# SDK is open source, and we welcome contributions from our community. Please see the Github Issue tracker for reported issues and follow the contribution documentation to become an active contributor this open source project. https://github.com/ringcentral/ringcentral-csharp/issues

This issue has more activity on this thread, please consider this post deprecated and use the original post for any content or new relating issues:  https://devcommunity.ringcentral.com/ringcentraldev/topics/long-running-subscription-issues-c-sdk
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.

John Wang avatar image John Wang ♦♦ commented ·
There are some open issues on the C# SDK but those only come into effect in a long-running subscription. The code provided below will subscribe to and receive decrypted events using the C# SDK.
0 Likes 0 ·
vyshakhbabji avatar image
vyshakhbabji Deactivated answered vyshakhbabji Deactivated commented
Please have a look at this code. I have subscription and presence working in C#. This should help :

https://github.com/vyshakhbabji/ringcentral-csharp-demo/blob/master/ConsoleApplication1/Program.cs
2 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.

mutahir-mehmood1102 avatar image mutahir-mehmood1102 commented ·
Hi Thanks for your help but, I am little confused when I was looking at your code. dont we have to use pubnub.Presence<string>()  method when we are looking to get notified on Presence? but instead you just used pubnub.Subscribe<string>(). Can you please clarify this? I am a newbie to pubnub
0 Likes 0 ·
vyshakhbabji avatar image vyshakhbabji ♦♦ commented ·
You are subscribing to presence event through subscription API. Please read the document here for subscription API .  https://developer.ringcentral.com/api-docs/latest/index.html

The subscription api will help you subscribe to presence api so that you dont have to poll for presence api. 
0 Likes 0 ·
John Wang avatar image
John Wang Deactivated answered
Using the C# SDK, the following example code should get you started. I just verified it working and receiving decrypted events. Since the C# SDK will automatically decrypt the PubNub payload, you should not need to specify any cipher keys yourself.

The following app is a console app that will listen to presence events and print out state changes. I've also added this example code here.
 http://ringcentral-sdk-csharp-simple.readthedocs.org/en/latest/notifications/Subscription/  
using System;  using RingCentral.SDK; using RingCentral.Subscription;  namespace console.subscribe {     class MainClass     {         static void ActionOnNotification(object message) {             var receivedMessage = message.ToString();             Console.WriteLine(receivedMessage);         }          static void ActionOnConnect(object message){             var receivedMessage = message.ToString();             Console.WriteLine(receivedMessage);         }          static void ActionOnError(object error) {             var receivedMessage = error.ToString();             Console.WriteLine(receivedMessage);         }          public static void Main (string[] args)         {             var url = "https://platform.devtest.ringcentral.com";             var sdk = new RingCentral.SDK.SDK("myAppKey", "myAppSecret", url, "appName", "appVersion");             sdk.GetPlatform().Authorize("myUsername", "myExtension", "myPassword", true);              var sub = new SubscriptionServiceImplementation(){ _platform = sdk.GetPlatform()};             sub.AddEvent("/restapi/v1.0/account/~/extension/~/presence");              sub.Subscribe(ActionOnNotification, ActionOnConnect, ActionOnError);              Console.ReadLine();             Console.WriteLine("Hello World!");         }     } }

               
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