question

Steve Moretz avatar image
Steve Moretz asked Steve Moretz commented

Get started with call logs and one-click calls

Hello this is my first day on ringcentral, I just signed up and finished the getting started process, I'm a software engineer and trying to implement two of your features using PHP, I need just a little guidance to start correctly.


First feature is one-click call we don't need fax/message or anything just the voice call one.
I assume we can use this:
https://github.com/ringcentral/ringcentral-embeddable

And disable fax and other features and tabs that we don't need? (If possible)

For call logs, we want all the logs for a particular customer (number) at a time, I assume we need to use this:
https://developers.ringcentral.com/api-reference/Call-Log/readUserCallLog

What I don't know is that should we register our customers (using api to ring central) in a way for this to work? or anyone who calls to the given number to us by ring-central will be available to access there? Is there any webhook for this as well? or a webhook for this event then we write manual code and call this inside of the webhook manually?

Thanks in advance.

call logsembeddable
1 |3000

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

Phong Vu avatar image
Phong Vu answered Steve Moretz commented

Here is my suggestion for you using low code option.

For the admin to call his clients directly from the page, you need a "click-to-dial" feature. If the admin wants to make a call from within the admin web page, then you can embed the RingCentral embeddable widget. If the admin wants to make a call from the RC app then you don't really need the RC embeddable. Below are the solution for both use cases

- Using the embeddable:

Embed the RC embeddable to the page. And when creating the page, put the client phone number in an element and add the onclick attribute to call the makeCall() function passing the client phone number to the function.

<html>
<head>
  ...
  <script>
      function makeCall(phoneNumber)
        document.querySelector("#rc-widget-adapter-frame").contentWindow.postMessage({
                  type: 'rc-adapter-new-call',
                  phoneNumber: phoneNumber,
                  toCall: true,
                  }, '*');
      }
  </script>
</head>
<body>
  <script>
    (function() {
      var rcs = document.createElement("script");
      rcs.src = "https://ringcentral.github.io/ringcentral-embeddable/adapter.js?defaultCallWith=browser";
      var rcs0 = document.getElementsByTagName("script")[0];
      rcs0.parentNode.insertBefore(rcs, rcs0);
    })();
  </script>
...
  <div><b>Click to dial from Embeddable</b></div>
   <ul>
    <li><div onclick="makeCall('+12091234567')">Alice 12091234567</div></li>
    <li><div onclick="makeCall('+14081234567')">Anne 14081234567</div></li>
   </ul>
...


- Using the RC app:

And when creating the page, put the client phone number in an <a> element and add the href attribute to launch the RC app using the URL schemes below

<a target="_blank" href="rcapp://r/dialer?number=+12091234567">Dial Alice</a></br>
<a target="_blank" href="rcapp://r/call?number=+14081234567">Call Anne</a>
...

Try it and you will see the different between the /dialer? and /call? mode. The user experience with this option is not as great as the one with the the embeddable.


For the clients to call the admin, you can implement the ring-out feature in your backend engine. And on the frontend (the client web page), provide a button called e.g. "Call me" which would take the client phone number (you can set the client number by default and allow them to change their number). When the client click the button, get the client number and send to your backend, where you will use the RingCentral platform API to make a ring-out call. Example in Node JS.

async function call_ringout() {
  try {
    var resp = await platform.post('/restapi/v1.0/account/~/extension/~/ring-out', {
      'from': { 'phoneNumber': CLIENT-PHONE-NUMBER },
      'to': { 'phoneNumber': ADMIN-PHONE-NUMBER },
      'playPrompt': false
    })
    var jsonObj = await resp.json()
    console.log("Call placed. Call status: " + jsonObj.status.callStatus)
  } catch (e) {
    console.log(e.message)
  }
}

Click here to learn more about /ring-out and see sample code in different programming languages.

Of course, you must construct a different page for client so they don't see the functions the admin can use to make call!

Your clients do not need to be a RingCentral customers. The /ring-out will make a call from their own phone (e.g if it's a mobile number, their cell phone will ring).

For call log, call the extension /call-log API to read call records of the admin.

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.

Steve Moretz avatar image Steve Moretz commented ·

@Phong Vu
Thank you so much for the detailed answer! Ring out sounds pretty cool it calls both admin and client from what I read in your answer and in the docs! I didn't even know that could be possible!

Thanks again you're the best I was lost in tons of documents, stuck trying to figure out what to do!

0 Likes 0 ·
Phong Vu avatar image
Phong Vu answered

I don't understand your definition and your expectation from 'one-click' calls. Did you mean 'click-to-dial' or 'click-to-call'?

The RC embeddable allows you to integrate the "RC phone app" into your Web app/page so you can login and make or receive calls, send SMS, Fax with just a few lines of code. If you want to customize the widget, you have to clone the project and customize the code and host the app on your own server. The instructions are detailed in the github page.

As for the call log, only RingCentral customers can access their own call logs. If you are an ISV who provides the service to multiple RingCentral customers, you can create a public app and allow your customers (who are also RingCentral customers) to login your app with their own login credentials, then you can use that user's access token to access their call log. However, if you need to read any user's call log in a RingCentral account, the authenticated user must be a super admin user (or a custom role which includes the company call log user permission).

Read this blog to learn more about RingCentral call log.

I don't understand also what you expect from using a webhook. So please clarify.

1 |3000

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

Steve Moretz avatar image
Steve Moretz answered

@Phong Vu

Thank you for responding, sorry for responding late I thought I'd get email notifications.

First let me clarify a few things I probably have been too vague, the scope is calls between one account and the people that call this one account only, we don't provide a service to multiple ringcentral customers.

On our website there is an admin account and the people who sign up are called clients.

We have a list of personal numbers of clients (their real phone numbers not ringcentral ones), we show the list of phone numbers to admin so he can call them without using ringcentral for now, but now we want to make the phone calls online so it becomes easier for the admin to contact any of the clients.


Also we show each client the admin's number (which is only one number for admin), they call the admin directly right now, but we want to make this online too.

So these are our intentions for the calls, please let us know if that is possible using RC Phone and embeddable widget.

And please give me a little more context wether the clients need ringcentral accounts as well to make the calls to the admin? Or the only thing that matters is that the admin has a ringcentral account?

--------------

As for the call logs, we only want the admin to see the logs of the client calls nothing more complicated than that, which we assume an api call will provide us the info? We would save that info in the database and that's why I was asking if this has a webhook available, but if there isn't one it's still okay.

And again please let me in order for these call logs to work, must customers call admin's ringcentral phone, with their own ringcentral numbers? or will it work if they use their regular (personal) numbers too?

1 |3000

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

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