question

keith-stephens-fax5580 avatar image
keith-stephens-fax5580 asked Tyler Liu answered

Asp.net C# To get all incoming and outgoing calls

Is it possible to get the incoming and outgoing call logs for all users in your organization?

I am needing to get all incoming calls that were answered, and all outgoing calls for each users in our organization and show how many calls were made per day for the previous week along with a total count.

Is this possible with the API? I have downloaded the ringcentral-csharp-client-master project, but I do not know were to being or how to even connect to the api.

Any help would be great, even better a small sample app to show how to connect and pull back some log data.

Thanks,

Keith.

topic-default
1 |1000

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

Tyler Liu avatar image
Tyler Liu answered
If you don't need real time data, you can just fetch the call logs.

Do you any specific issues following the readme file?   https://github.com/ringcentral/ringcentral-csharp-client#installation
1 |1000

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

keith-stephens-fax5580 avatar image
keith-stephens-fax5580 answered

I have 4 individual applications that should be connecting with RingCentral but they are giving me errors.

RingCentral-csharp-client-master application. The  public AuthorizeTest(RestClientFixture fixture) test job.

When I debug this test job I get the following error.
 FlurlHttpException: Request to https://platform.devtest.ringcentral.com/restapi/oauth/token failed with status code 400 (Bad Request).
 
 My test application.

Just want to get a successful connection. I followed the install instruction.

   RestClient rc = new RestClient("Key", "Secret", "https://platform.devtest.ringcentral.com");     
            rc.Authorize("Username", "", "password");
            var extension = rc.Restapi().Account().Extension();
            var callLogs = extension.CallLog().List(new { direction = "Inbound" });
            var account =  rc.Restapi().Account().Get();

I get the following for callLogs and account
 callLogs Id = 37, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}"
account Id = 44, Status = WaitingForActivation, Method = "{null}", Result = "{Not yet computed}"


Through Chromes PostMon application
https://medium.com/ringcentral-developers/using-postman-with-swagger-and-the-ringcentral-api-523712f...

Gives me the following error.

{
  "error": "unauthorized_client",
  "error_description": "Unauthorized for this grant type"
}


From the test pages on the Dev site.

http://ringcentral.github.io/api-explorer/#!/Account_and_Extension_Information/v1_0_account__account...

I am running the very 1st Post call under Authentication.

/oauth/token

{
  "error": "unauthorized_client",
  "error_description": "Unauthorized for this grant type" }

1 |1000

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

Tyler Liu avatar image
Tyler Liu answered
For the 400 error, please catch the exception and print the response. https://github.com/tmenier/Flurl/issues/114 http://tmenier.github.io/Flurl/error-handling/

I think it is because you didn't setup the testing project:  https://github.com/ringcentral/ringcentral-csharp-client/tree/master/RingCentral.Test#setup


For RingCentral-csharp-client application, all the http requests are async, so please don't treat them as sync. 

For example:  var account =  rc.Restapi().Account().Get();

should be change to either  var account =  await rc.Restapi().Account().Get();

or  var account =  rc.Restapi().Account().Get().Result;

If you treat them as sync and set a break point, you won't be able to see any data.
1 |1000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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