News & Announcements User Community Developer Community

Welcome to the RingCentral Community

Please note the community is currently under maintenance and is read-only.

Search
Make sure to review our Terms of Use and Community Guidelines.
  Please note the community is currently under maintenance and is read-only.
Home » Developers
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
answered on Feb 11, 2016 at 7:37am  
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
answered on Feb 9, 2016 at 2:57pm  
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

 0
answered on Feb 9, 2016 at 9:26am  
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

 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

PRODUCTS
RingEX
Message
Video
Phone
OPEN ECOSYSTEM
Developer Platform
APIs
Integrated Apps
App Gallery
Developer support
Games and rewards

RESOURCES
Resource center
Blog
Product Releases
Accessibility
QUICK LINKS
App Download
RingCentral App login
Admin Portal Login
Contact Sales
© 1999-2024 RingCentral, Inc. All rights reserved. Legal Privacy Notice Site Map Contact Us