How to place a test RingOut call?

I am testing RingCentral RingOut functionality and by following the docs working on it. But I am facing a few problems:

  1. which countries RingCentral supports to call (from and to)?
  2. How can I place a test call using two different cell numbers?

Currently, I am making a RingOut request but in response i'm getting 400 bad request error with message of that:

from and to ("Unrecognized token 'from': was expecting 'null)

Updated:

Sending ajax request having these params:

var url = 'https://platform.devtest.ringcentral.com/restapi/v1.0/account/~/extension/~/ringout';
var data = {
            "from": {"phoneNumber": "usa_phone_sandboxed"},/*from parameter is optional if there is a default number in user's forwarding numbers */ 
            "to": {"phoneNumber": "usa_phone_real"},  /*to parameter is required */ 
            /*"playPrompt": true  optional field */
            };
var headersArray = [
                       {"Content-Type":  "application/json"}, 
                       {"Authorization": "Bearer "+my_access_token}
                   ];

I'm using a sandbox account. Language: Javascript on browser side.

Upvotes: 0

Views: 620

Answers (1)

Benjamin Dean
Benjamin Dean

Reputation: 1298

To solve the 400 (Bad Request) issue, the first thing you'll want to do is GET the list of Forwarding Numbers to determine if there is a default number configured in the forwarding numbers for your account. This will let you know if you need to provide the from object or not in your POST RingOut request.

If the totalResults === 0 and defaultNumber is not set for your extension's forwarding numbers, then you must provide the from object in the POST body.

{
    "from": {
        "phoneNumber":"{{rcUsername}}"
    },
    "to": {
            "phoneNumber":"{{toPhoneNumber}}"
    }
}

Remember the from.phoneNumber will need to be your extension's direct number or one of your extension's available forwarding numbers. The to.phoneNumber should be the phone number for your contact.

You asked the following questions as well:

Which countries RingCentral supports to call(from and to)?

This is going to depend upon your account type and extension settings. First you will want to know if the currently authenticated extension is generally able to make International Calls. This can be done using GET an Extension by Id the response body will contain a property named serviceFeatures, the featureName === InternationalCalling is the right property to view first.

For example, here is this setting in my free developer account (which means I cannot make international calls with my extension):

{
      "featureName": "InternationalCalling",
      "enabled": false,
      "reason": "AccountTypeLimitation"
}

For comprehensive information about your account's international dialing capabilities, you will want to view the RingCentral Online Account Portal.

How I can place a test call using two different cell numbers?

Not sure I completely follow your question, do you mean using two different to.phoneNumbers or two different from.phoneNumbers? Could you provide more specifics about what you are trying to achieve?

Upvotes: 1

Related Questions