ringcentral / RingCentral.Net

RingCentral SDK for .NET
MIT License
19 stars 26 forks source link

SDK throwing error while deserializing CSN notification event #9

Closed vyshakhbabji closed 5 years ago

vyshakhbabji commented 5 years ago

When trying to make a call using the CallSessions approach with the C# SDK, I'm getting an error. The call still goes through, but it looks like the SDK is having some issues parsing the JSON response. The error means that we're unable to process the response as we don't get it. The error is: Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'RingCentral.CallParty' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.

To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array. Path 'session.parties', line 8, position 19.

tylerlong commented 5 years ago

Can we get more detail please? Such as code snippet? It doesn't seem like a notification issue:

When trying to make a call using the CallSessions approach

vyshakhbabji commented 5 years ago

// https://developers.ringcentral.com/my-account.html#/applications // Find your credentials at the above url, set them as environment variables, or enter them below

// PATH PARAMETERS string accountId = "";

// POST BODY MakeCallOutRequest makeCallOutRequest = new MakeCallOutRequest { from = new MakeCallOutCallerInfoRequestFrom { deviceId = "" }, to = new MakeCallOutCallerInfoRequestTo { phoneNumber = "", extensionNumber = "" } };

RestClient rc = new RestClient( Environment.GetEnvironmentVariable("clientId"), Environment.GetEnvironmentVariable("clientSecret"), false ); await rc.Authorize( Environment.GetEnvironmentVariable("username"), Environment.GetEnvironmentVariable("extension"), Environment.GetEnvironmentVariable("password") ); var r = await rc.Restapi().Account(accountId).Telephony().CallOut().Post(makeCallOutRequest); // PROCESS RESPONSE

vyshakhbabji commented 5 years ago

@tylerlong u r right , this is with callout api call using c# code snippet on the api explorer

It's basically just using the sample code shown in the C# section on the right at https://developers.ringcentral.com/api-reference/Call-Control/createCallOutCallSession. In terms of the logs, all I have is the error message I sent, as soon as we run the code to make the call, we get the error. Let me know if there are any other details that might be helpful.

tylerlong commented 5 years ago
Screen Shot 2019-09-03 at 3 12 38 PM

I just tired this endpoint and I had no problem

tylerlong commented 5 years ago

Oh, I forgot that I just release the latest 2.0.1 version of the SDK. Please have a try and let me know if you still have this issue.