question

DANG designs avatar image
DANG designs asked Phong Vu commented

How to Use PHP on Cpanel to get Call Logs From All Users

I've been researching on how to access the logs for RingCentral for a while now and I'm having a bit of trouble. Essentially, I want to use a file on our web server to call the API and fetch all the records for every user (not just the owner account that I have the credentials set up on). Afterwards, I plan to store them in our database but I don't think I'll have issues there. From the link below, and other alternatives I've tried (Zapier), it appears that I need the username, password, and extension to get all this information collectively. Is there a way to get this information without requiring all users' passwords?

https://developers.ringcentral.com/guide/voice/call-log/reading-call-log#php

apicall logsphp
1 |1500 characters needed characters left characters exceeded

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

1 Answer

Phong Vu avatar image
Phong Vu answered Phong Vu commented

You need to login your app with an admin user and use the account call log API:

https://developers.ringcentral.com/api-reference/Call-Log/readCompanyCallLog

6 comments
1 |1500 characters needed characters left characters exceeded

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

Thank you for reaching out!

I think that page leads me to have more questions. What is the accountid and where can I find it in the ringCentral account? What is the serverURL for the getenv variable? Also, the 27th line shows login information where the password is still required, right?

0 Likes 0 ·

Thanks for the heads up. I'm still having a bit of trouble. I can get the authorization code now but I can't seem to get the token. Here is the code that I'm using:

curl_setopt_array($curlpost, array(
    CURLOPT_URL => "https://platform.devtest.ringcentral.com/restapi/oauth/token?code={$authCode}&grant_type={$grant_type}&redirect_uri={$redirect_uri}",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_HTTPHEADER => array(
        "Accept: application/json",
        "Content-Type: application/x-www-form-urlencoded",
        "Authorization: Basic " .$base64test
    ),
    ));
    



0 Likes 0 ·
Show more comments

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