Can i place a call from browser to phone using Ringout?

  • 1
  • Question
  • Updated 1 year ago
  • (Edited)
Hello

I am developing a chrome extension where i am using Ringout to place call, as docs says that Ringout help to connect call between two phone numbers.

Here i have from and to phoneNumbers and using Rest call i can place call. Is there necessary to configure a from phoneNumber with some direct line or will it use browser's mic to place call?

While my task is to call from extension to some phone no.

I have created a direct phone no and 1 direct line for pc using sandbox account, i want to test a call from extension to desktop using Ringcentral Ringout.

Plz help me either this approach is right or not.


Thanks
Photo of Akif Akif

Akif Akif

  • 96 Points 75 badge 2x thumb

Posted 1 year ago

  • 1
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,622 Points 5k badge 2x thumb
Hey Akif,

1. Is it necessary to configure a from.phoneNumber using a direct line or will it use browser's mic to place call?

Answer:

If you are using RingOut via the API to make a call, you will need to provide a from.phoneNumber === one of the authenticated extension's valid phone numbers. See the alternative answer below for information about using WebRTC.

GET /restapi/v1.0/account/~/extension/<extensionId || ~>/phone-number 
From: https://platform[.devtest].ringcentral.com
Content-Type: application/json
Accept: application/json
Authorization: Bearer {{YOUR_VALID_ACCESS_TOKEN}}

A successful response to GET Extension Phone Numbers will contain a "records" property, where each record is a phoneNumber which can be used in the POST Body of an HTTP Request to RingOut if the following criteria are satisfied:

  • usageType (one of) === MainCompanyNumber, CompanyNumber, DirectNumber 
  • type (one of) === VoiceFax, VoiceOnly
  • status === Normal
  • features === CallerId

2. I have created a direct phone no and 1 direct line for pc using sandbox account, I want to test a call from extension to desktop using RingCentral RingOut. What should I do?

Answer:

You cannot make a call from the extension to the desktop (if you are authenticated as the user you are calling, since you will receive a busy signal). You can however make a call from the extension (using the RingCentral Desktop Soft Phone) to an external phone number such as your cellular device or any other valid phone number in a country the authenticated extension is permitted to dial. Here are the basic instructions for this...
  1. GET an "access_token" for the Extension you created (as referenced in your question)
  2. GET the Extension's Phone Number List
  3. Filter the list and identify one of the phone number records which satisfies the criteria listed above, then cache the "phoneNumber" property of that record to use as the "from.phoneNumber" value in the POST body of your RingOut API Request to  Make a Call.
  4. Setup your POST HTTP Request, implementing the from.phoneNumber as indicated in step #3.
Alternative Answer:

You could make a phone call directly from the browser if you implement RingCentral WebRTC and the RingCentral Web Phone Client Library, but this will require additional code, an application which is configured with the necessary "VOIP Calling" API Permissions and configured to use Authorization Flow permitting users to authorize your app to obtain a valid token for interacting with the RingCentral API and services on their behalf. There is a demo application within the RingCentral Web Phone Client Library on Github you can use for testing and to inspect how to properly operate with the API it provides. Additionally, the Web Phone Client Library contains step-by-step directions on how to create and configure an application in the RingCentral Developer Portal for use with WebRTC.

Let me know if this answers your question.
Photo of Akif Akif

Akif Akif

  • 96 Points 75 badge 2x thumb
Thanks @Benjamin Dean for comment and help.

I have tried Ringcentral web rtc demo on my localhost,  when demo code sends post request to get access token, so i receive error in response saying: "Unauthorized for this grant type", code 0AU-251.

Note:
On other side my app have voip calling permision, platform(browser) and authorization have auth code flow and refresh token permissions.

app_redirect_url: http://localhost/ringcentral_webrtc_github/demo/


(Edited)
Photo of Benjamin Dean

Benjamin Dean, Alum

  • 8,622 Points 5k badge 2x thumb
Try adding these Redirect URLs to your app:

http://localhost:8080/demo/callback.html

http://localhost:8080/callback.html

That might solve that problem.
Photo of VB

VB, Official Rep

  • 1,410 Points 1k badge 2x thumb
You could pull the app from the develop branch from my repository. https://github.com/vyshakhbabji/web-phone-1/tree/develop1  This repo is set up for 3 legged authorization. 

You will need to follow https://developer.ringcentral.com/api-docs/latest/index.html#!#AuthorizationCodeFlow   this document to set up your app on Dev Portal with redirect url. 

These links might come handy:
https://github.com/ringcentral/ringcentral-demos-oauth