question

chris-goetz avatar image
chris-goetz asked John Wang Deactivated commented

Long-Running subscription issues C# SDK

I have a winform app that will run either minimized or in the system tray. Part of its job is to display incoming caller info. I am using the C# SDK to successfully authenticate, create the subscription and then receive notification information. The problems start when I just leave the program running and no new events are coming in simulating the use case where someone leaves the program running overnight (or an extended lunch). We start to see first chance web socket exceptions, null exceptions and eventually a code break will happen and a final error will indicate that objects have been optimized away. These errors are coming from the SDK code and don't bubble up through any try/catch code so that I could handle the error. The application is dead simple at this point. It connects, authorizes, creates a subscription and listens via callbacks. Is there a method I need to call on a timer to keep the objects alive?

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.

chris-goetz avatar image
chris-goetz answered
Quick update.  I downloaded the code from github and compiled locally.  Used those in the project instead of getting the SDK from Nuget.  Isolated the issue to the PubnubCore ClientNetworkStatus.cs file.  Looks like the error is being thrown from the ParseCheckSocketConnectException<T> method.  Looks like it believes that the Internet/socket connection was lost.  Still looks like an object was caught up by garbage collection but I can't tell which one.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

eziel-fleischman449 avatar image
eziel-fleischman449 answered
I have the same experience. its an issue with pubnub. I publicly complaint about it on stackoverflow a year ago. http://stackoverflow.com/questions/24144196/keeping-connection-to-pubnub-open

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

chris-goetz avatar image
chris-goetz answered
Definitely leaning toward an issue with pubnub.  Getting these errors continuously today.

StatusCode=5040
Severity=Critical
MessageSource=Server
IsDotNetException=False
Message=
DetailedDotNetException=
PubnubWebRequest=PubNubMessaging.Core.PubnubWebRequest PubnubWebResponse=PubNubMessaging.Core.PubnubWebResponse
Channel=
ChannelGroup=
Description=Gateway Timeout. Please try again. If the issue continues, please contact PubNub support
ErrorDateTimeGMT=12/10/2015 5:47:56 PM

After receiving that particular message, I wait 60 seconds and reconnect to the subscription. It will run for about 60 seconds and then throw the error again.

1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

geremy-cohen537 avatar image
geremy-cohen537 answered
@chris & @eziel, please contact us directly at support@pubnub.com so we can get the appropriate steps to repro, and more info on your configs, so we can fix this.
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

chris-goetz avatar image
chris-goetz answered
Got it.  Just sent an email over with all of the details.  I'll be happy to share the exact code that we are using to test the functionality if the instructions for recreating don't make sense in the support ticket.
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 benjamin-dean commented
Hello Chris,

Have you resolved this issue with Geremy's assistance?
9 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.

chris-goetz avatar image chris-goetz commented ·
Got past the gateway timeout issue with pubnub's help enabling/forcing ssl when creating the subscription.  We also found that a couple of objects in the SDK were being disposed (picked up by garbage collection) after long periods of inactivity.  Fixed that as well.  Now working on figuring out why the Subscribe method in the SDK is throwing an error when a disconnect message is fired (again after a long period of time goes by simulating a user being logged in overnight).
1 Like 1 ·
chris-goetz avatar image chris-goetz commented ·
We are continuing to test but are running into small issues at this point related to error handling for devices that rely on wireless connections or where wired connections are not as reliable.  We will post the errors and where they are occurring once we nail it down.

I'll post an issue in github shortly to help correct a timeout issue when behind a proxy that is outside our control for configuration.
1 Like 1 ·
chris-goetz avatar image chris-goetz commented ·
Added a couple more issues to Github.  Seems like if we can nail those down, we should be in the clear.  Everything else is working great.
1 Like 1 ·
chris-goetz avatar image chris-goetz commented ·
Still working on it but the ball is in our court.  We lost a power supply in our dev machine.  Should be back up and running by tomorrow so that we can continue testing.
0 Likes 0 ·
benjamin-dean avatar image benjamin-dean commented ·
Outstanding! Please let us know if you run into any snags.
0 Likes 0 ·
vyshakhbabji avatar image vyshakhbabji ♦♦ commented ·

Hi Chris,

How's your integration going? Do you still see issues with PubNub or C# SDK? Do mail us or submit a support ticket and we can help you out if you have specific questions.

0 Likes 0 ·
benjamin-dean avatar image benjamin-dean commented ·
How are things progressing here Chris. Anything I can help with? Will you create these issues in the C# SDK as you come across them (so we can try to get additional help on them) please?

https://github.com/ringcentral/ringcentral-csharp/issues
0 Likes 0 ·
benjamin-dean avatar image benjamin-dean commented ·
Saw the issues in Github for the RingCentral C# SDK, thanks for doing that Chris. Anytime there are issues with the SDK, looking in the Github issue tracker and reporting new issues if one doesn't already exist is usually a good first step towards getting it resolved.
0 Likes 0 ·
benjamin-dean avatar image benjamin-dean commented ·
We're working on prioritizing these issues, but any help is always welcomed, especially since the C# SDK is open source.

We have a couple of community members who need to resolve these bugs to continue moving forward, if we could get some help from the community to assign one or two of these issues and resolve with a pull request, it would help everyone. We will continue getting these prioritized, in the meantime you can use the Github issue tracker to watch or contribute. :)
0 Likes 0 ·
mutahir-mehmood1102 avatar image
mutahir-mehmood1102 answered benjamin-dean commented
Hi everyone I am also having issue with Pubnub C# sdk and Presence Api. I am not being able to receive notifications when RingCentral phone changes its state. can anyone please help me?

I have created a new forum post link is below please have a look
https://devcommunity.ringcentral.com/ringcentraldev/topics/having-issue-when-using-c-sdk-and-using-p...

3 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.

chris-goetz avatar image chris-goetz commented ·
Sounds like a different issue. Make sure to include "?detailedTelephonyState" at the end of the event subscription URL to get the right information. Second, if you don't have the soft phone running and logged into your test account, you will not receive presence events via the sdk.
1 Like 1 ·
echo1-pan11149 avatar image echo1-pan11149 commented ·
Please use the RingCentral C# SDK which includes the PubNub C# SDK as a dependency. There should be no need to use the PubNub C# SDK directly. The RingCentral C# SDK will manage connections with PubNub and also automatically decrypt messages for you. I posted some working code in that thread using the RingCentral C# SDK which will receive and print presence events.
1 Like 1 ·
benjamin-dean avatar image benjamin-dean commented ·
Adding the URI for the sample code provided by @Echo1 Pan1 (thanks for that!)

https://devcommunity.ringcentral.com/ringcentraldev/topics/having-issue-when-using-c-sdk-and-using-p...
0 Likes 0 ·
benjamin-dean avatar image
benjamin-dean answered
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
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 Deactivated answered
We have uploaded an alpha fix for this on to NuGet:

0.1.2 alpha 4:  http://www.nuget.org/packages/RingCentralSDK/0.1.2-alpha4

Please try it out and provide feedback here or on GitHub:

GitHub issues:  https://github.com/ringcentral/ringcentral-csharp/issues

Thanks!
1 |3000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

chris-goetz avatar image
chris-goetz answered John Wang Deactivated commented
Testing with the simplified code shared above.  Looks like the original issues are fixed.  Ran for many hours and did not see a disconnect.  A new issue seems to be we are not getting subscription messages when the presence is supposed to change to "Ringing".  The softphone is still configured to connect to the sandbox account and is prompting correctly for inbound calls.  When watching the code execution we are getting nothing on the notification side from the subscription.  Tested this out on the original code, and the simplified example shared above.  No dice.
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 ·
Thanks Chris. I noticed the same thing testing alpha6. Will work with the team to look into this. 
0 Likes 0 ·

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