Having Issue When Using C# SDK and using Presence API
Tags: sdk
Feb 9, 2016 at 8:51am • 3 replies • 0 likes
mutahir-mehmood
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
3 Answers
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.
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
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
https://github.com/vyshakhbabji/ringcentral-csharp-demo/blob/master/ConsoleApplication1/Program.cs
0
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
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
0
A new Community is coming to RingCentral!
Posts are currently read-only as we transition into our new platform.We thank you for your patience
during this downtime.
Try Workflow Builder
Did you know you can easily automate tasks like responding to SMS, team messages, and more? Plus it's included with RingCentral Video and RingEX plans!Try RingCentral Workflow Builder