Get Started with Call Routing

Last updated: 2024-02-28Contributors
Edit this page

To help you get started using the Call Routing API, the following code samples have been provided. These code samples perform the simple function of listing the call answering rules associated with the current user. This code sample is based on our Voice quick start guides. If you have not completed that guide, we recommend you do so first, as this is an abbreviated version of that guide.

Create an app and obtain credentials

The first thing we need to do is create an app in the RingCentral Developer Console. This can be done quickly by clicking the "Create Call Routing App" button below. Just click the button, enter a name and description if you choose, and click the "Create" button. If you do not yet have a RingCentral account, you will be prompted to create one.

Create Call Routing App

  1. Login or create an account if you have not done so already.
  2. Go to Console/Apps and click 'Create App' button.
  3. Select "REST API App" under "What type of app are you creating?" Click "Next."
  4. Under "Authentication" select "Password-based auth flow."
  5. Under "Security" add the following permissions:
    • ReadAccounts
  6. Under "Security" select "This app is private and will only be callable using credentials from the same RingCentral account."

When you are done, you will be taken to the app's dashboard. Make note of the Client ID and Client Secret. We will be using those momentarily.

Read User Call Answering Rules

const RC = require('@ringcentral/sdk').SDK

var rcsdk = new RC({
    'server':       process.env.RC_SERVER_URL,
    'clientId':     process.env.RC_CLIENT_ID,
    'clientSecret': process.env.RC_CLIENT_SECRET
var platform = rcsdk.platform();
platform.login({ 'jwt':  process.env.RC_JWT })

platform.on(, function(response) {

async function get_user_call_answering_rules() {
  try {
    var resp = await platform.get('/restapi/v1.0/account/~/extension/~/answering-rule', {
      'view': "Detailed",
      'enabledOnly': false
    var jsonObj = await resp.json()
    for (var record of jsonObj.records) {
  } catch (e) {

async function get_user_call_answering_rule(id) {
  try {
    var resp = await platform.get('/restapi/v1.0/account/~/extension/~/answering-rule/' + id)
    var jsonObj = await resp.json()
  } catch (e) {

# You get the environment parameters from your 
# application dashbord in your developer account 

import os
import sys

from dotenv import load_dotenv
from ringcentral import SDK

rcsdk = SDK( os.environ.get('RC_CLIENT_ID'),
             os.environ.get('RC_SERVER_URL') )
platform = rcsdk.platform()
  platform.login( jwt=os.environ.get('RC_JWT') )
except Exception as e:
  sys.exit("Unable to authenticate to platform: " + str(e))

params = {
    'view': "Detailed",
    'enabledOnly': False
    resp = platform.get('/account/~/extension/~/answering-rule', params)
    for record in resp.json().records:
        rule = platform.get('/account/~/extension/~/answering-rule/' +
        print( f'Answering rule: {rule["name"]} is of type {rule.type}' )
except Exception as e:
    sys.exit( e )
    sys.exit( 0 )
/* You get the environment parameters from your 
   application dashbord in your developer account */

$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');

$rcsdk = new RingCentral\SDK\SDK( $_ENV['RC_CLIENT_ID'],
                                  $_ENV['RC_SERVER_URL'] );
$platform = $rcsdk->platform();
$platform->login( [ "jwt" => $_ENV['RC_JWT'] ] );

try {
    $resp = $platform->get('/account/~/extension/~/answering-rule',
        'view' => "Detailed",
        'enabledOnly' => False
    $jsonObj = $resp->json();
    foreach ($jsonObj->records as $record){
    // use the $record->id to read rule details
    $resp = $platform->get('/account/~/extension/~/answering-rule/' . $record->id );
} catch (Exception $e) {
    echo $e->getMessage()."\n";
using System;
using System.Threading.Tasks;
using RingCentral;
using Newtonsoft.Json;

namespace Get_User_Call_Answering_Rules
  class Program
    static RestClient restClient;
    static async Task Main(string[] args)
      restClient = new RestClient(
      await restClient.Authorize(Environment.GetEnvironmentVariable("RC_JWT"));

      await get_user_call_answering_rules();

    static private async Task get_user_call_answering_rules()
      var parameters = new ListAnsweringRulesParameters();
      parameters.view = "Detailed";
      parameters.enabledOnly = "false";

      var resp = await restClient.Restapi().Account().Extension().AnsweringRule().List(parameters);
      foreach (var record in resp.records)
        var rule = await restClient.Restapi().Account().Extension().AnsweringRule(;
package com.ringcentral;

import com.ringcentral.*;
import com.ringcentral.definitions.*;

public class ReadUserAnsweringRules {
    static RestClient rc;

    public static void main(String[] args) {
        var obj = new ReadUserAnsweringRules();
    rc = new RestClient( System.getenv("RC_CLIENT_ID"),
                 System.getenv("RC_SERVER_URL") );
    try {
        rc.authorize( System.getenv("RC_JWT") );
    } catch (RestException | IOException e) {

    public void get_user_call_answering_rules() throws RestException, IOException {
    var parameters         = new ListAnsweringRulesParameters();
    parameters.view        = "Detailed";
    parameters.enabledOnly = false;

    UserAnsweringRuleList response = rc.restapi().account().extension().answeringRule().list(parameters);
    for (var record : response.records) {
        var rule = rc.restapi().account().extension().answeringRule(;
        System.out.println("Name: " +;
        System.out.println("Type: " + rule.type);

# You get the environment parameters from your 
# application dashbord in your developer account 

require 'ringcentral'
require 'dotenv/load'

$rc =['RC_CLIENT_ID'],

$rc.authorize(jwt: ENV['RC_JWT'])

resp = $rc.get('/restapi/v1.0/account/~/extension/~/answering-rule', {
    view: "Detailed",
    enabledOnly: false
for record in resp.body['records'] do
    rule = $rc.get('/restapi/v1.0/account/~/extension/~/answering-rule/' + record['id'])
    puts rule.body