Finding Active Calls on the Network

Last updated: 2024-01-31Contributors
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 intended 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 WebSockets.

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();

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(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/python

# You get the environment parameters from your 
# application dashbord in your developer account 
# https://developers.ringcentral.com

import os
import sys

from dotenv import load_dotenv
from ringcentral import SDK
load_dotenv()

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

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
/* You get the environment parameters from your 
   application dashbord in your developer account 
   https://developers.ringcentral.com */

require('vendor/autoload.php');
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/../');
$dotenv->load();

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

$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_JWT")).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_JWT") );
        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);
    }
    }
}
#!usr/bin/ruby

# You get the environment parameters from your 
# application dashbord in your developer account 
# https://developers.ringcentral.com

require 'ringcentral'
require 'dotenv/load'

$rc = RingCentral.new(ENV['RC_CLIENT_ID'],
                      ENV['RC_CLIENRT_SECRET'],
                      ENV['RC_SERVER_URL'])

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

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