Finding Active Calls on the Network

Last updated: 2021-12-03 Contributors Byrne ReesePaco VuNone
Edit this page

Active Calls provides developers with time-sensitive insights into what is (or has recently) occurred in your RingCentral Account. We can perform this lookup at the Account Level or at the Extension Level depending upon the role of the user who has authenticated and obtained an access_token.

Active Calls are not real time. There is some latency between the time when a call has terminated and when it shows up in the records returned, this latency differs but it is typically 3-10 seconds.

Active Calls are created to work as a tool for developers who need to lookup call log data to append notes, and sentiment for things such as CRM integrations. Active Calls are a handy tool for looking up this time-sensitive information, but this can also be confusing for developers expecting this Call Log data type to represent real time active calls. For real-time or near real-time call data developers will want to either use Webhooks or Push Notification.

Developers should consider Active Calls to be a time-sensitive cache, where the default period of time a call remains in this cache (after being ended) is approximately 120 seconds.

See Also: Call Log

The Active Call API is a close cousin to the RingCentral Call Log API using identical data constructs and responses. The key and only difference being the following:

  • Active Call API returns a list of live calls in an account. These are calls that have been connected to an extension. It does not return calls currently being routed to an extension.
  • Active Call API connects to a different URL/endpoint.

Query parameters are dropped if supplied and only Simple views of Call Log data are available using Active Call requests.

Developers can access a list of active calls for an entire account. This requires an Admin account to authenticate and obtain the access_token used for this request.

GET /restapi/v1.0/account/~/active-calls HTTP/1.1

Warning

Attempting to access Account-Level Active Calls with an access_token that is not associated with an Admin account will result in the following "InsufficientPermissions" error: [ReadCompanyCallLog] permission required.

Extension Level Active Calls

Developers can access a list of active calls associated with the currently authenticated access_token user account credentials.

GET /restapi/v1.0/account/~/extension/~/active-calls HTTP/1.1

Response Format

The response format for active calls mirrors that of Call Log responses exactly.

Sample Code to Get Started with reading user active calls

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

CLIENTID     = process.env.RC_CLIENT_ID
CLIENTSECRET = process.env.RC_CLIENT_SECRET
SERVER       = process.env.RC_SERVER_URL
USERNAME     = process.env.RC_USERNAME
PASSWORD     = process.env.RC_PASSWORD
EXTENSION    = process.env.RC_EXTENSION

var rcsdk = new RC({
    server:       SERVER,
    clientId:     CLIENTID,
    clientSecret: CLIENTSECRET
});
var platform = rcsdk.platform();
platform.login({
    username:  USERNAME,
    password:  PASSWORD,
    extension: EXTENSION
})

platform.on(platform.events.loginSuccess, function(response) {
  read_active_calls()
});

async function read_active_calls() {
  try {
    var resp = await platform.get('/account/~/extension/~/active-calls', {
      view: 'Simple'
    })
    var jsonObj = await resp.json()
    for (var record of jsonObj.records)
      console.log("Call result: " + record.result)
  } catch (e) {
    console.log(e.message)
  }
}
#!/usr/bin/env python
from ringcentral import SDK
import os,sys

CLIENTID     = os.environ.get('RC_CLIENT_ID')
CLIENTSECRET = os.environ.get('RC_CLIENT_SECRET')
SERVER       = os.environ.get('RC_SERVER_URL')
USERNAME     = os.environ.get('RC_USERNAME')
PASSWORD     = os.environ.get('RC_PASSWORD')
EXTENSION    = os.environ.get('RC_EXTENSION')

rcsdk = SDK( CLIENTID, CLIENTSECRET, SERVER )
platform = rcsdk.platform()
try:
  platform.login(USERNAME, EXTENSION, PASSWORD)
except:
  sys.exit("Unable to authenticate to platform. Check credentials.")

params = {
    'view' : 'Simple'
}

resp = platform.get('/restapi/v1.0/account/~/extension/~/active-calls', params)
for record in resp.json().records:
    print(f'Call result: {record.result}')
<?php
require('vendor/autoload.php');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();

$CLIENTID     = $_ENV['RC_CLIENT_ID'];
$CLIENTSECRET = $_ENV['RC_CLIENT_SECRET'];
$SERVER       = $_ENV['RC_SERVER_URL'];
$USERNAME     = $_ENV['RC_USERNAME'];
$PASSWORD     = $_ENV['RC_PASSWORD'];
$EXTENSION    = $_ENV['RC_EXTENSION'];

$rcsdk = new RingCentral\SDK\SDK($CLIENTID, $CLIENTSECRET, $SERVER);
$platform = $rcsdk->platform();
$platform->login($USERNAME, $EXTENSION, $PASSWORD);

$params = array(
   'view' => 'Simple'
    );
$resp = $platform->get('/account/~/extension/~/active-calls', $params);
foreach ($resp->json()->records as $record) {
    print_r ("Call result: ".$record->result);
}
?>
using System;
using System.Threading.Tasks;
using RingCentral;

namespace Read_User_ActiveCalls
{
    class Program
    {
        static RestClient restClient;
    static void Main(string[] args)
    {
            restClient = new RestClient(
        Environment.GetEnvironmentVariable("RC_CLIENT_ID"),
        Environment.GetEnvironmentVariable("RC_CLIENT_SECRET"),
        Environment.GetEnvironmentVariable("RC_SERVER_URL"));
            restClient.Authorize(
        Environment.GetEnvironmentVariable("RC_USERNAME"),
        Environment.GetEnvironmentVariable("RC_EXTENSION"),
        Environment.GetEnvironmentVariable("RC_PASSWORD")).Wait();
        read_user_active_calls().Wait();
    }
    static private async Task read_user_active_calls()
    {
        var parameters = new ListExtensionActiveCallsParameters();
        parameters.view = "Simple";
        var resp = await restClient.Restapi().Account().Extension().ActiveCalls().Get(parameters);
        foreach (CallLogRecord record in resp.records)
        {
        Console.WriteLine("Call result: " + record.result);
        }
    }
    }
}
package com.ringcentral;

import com.ringcentral.*;
import com.ringcentral.definitions.*;
import java.io.IOException;

public class FindActiveUserCalls {
    static RestClient rc;

    public static void main(String[] args) {
    var obj = new FindActiveUserCalls();
    rc = new RestClient( System.getenv("RC_CLIENT_ID"),
                 System.getenv("RC_CLIENT_SECRET"),
                 System.getenv("RC_SERVER_URL") );
    try {
        rc.authorize( System.getenv("RC_USERNAME"),
              System.getenv("RC_EXTENSION"),
              System.getenv("RC_PASSWORD") );
        obj.read_user_active_calls();
    } catch (RestException | IOException e) {
        e.printStackTrace();
    }
    }

    public void read_user_active_calls() throws RestException, IOException {
    var parameters = new ListExtensionActiveCallsParameters();
    parameters.view = "Simple";
    UserActiveCallsResponse response = rc.restapi().account().extension()
        .activeCalls().get(parameters);
    for (UserCallLogRecord record : response.records) {
        System.out.println("Call result: " + record.result);
    }
    }
}
require 'ringcentral'
require 'dotenv/load'

CLIENTID     = ENV['RC_CLIENT_ID']
CLIENTSECRET = ENV['RC_CLIENRT_SECRET']
SERVER       = ENV['RC_SERVER_URL']
USERNAME     = ENV['RC_USERNAME']
PASSWORD     = ENV['RC_PASSWORD']
EXTENSION    = ENV['RC_EXTENSION']

$rc = RingCentral.new(CLIENTID, CLIENTSECRET, SERVER)
$rc.authorize(username: USERNAME, extension: EXTENSION, password: PASSWORD)

resp = $rc.get('/restapi/v1.0/account/~/extension/~/active-calls', {
    view: 'Simple'
})

for record in resp.body['records'] do
    puts "Call result: " + record['result']
end