Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

You can test API methods on the interactive API browser page and without writing code
Some of the resources described on the page may not be available by default due to the type of application (see Creating and authorizing applications).

This resource allows you to get a summary data on calls for a specified time period or for a specific internal number (total quantity, quantity of missed calls, etc.). Events on the extension can be found here. When sending requests, you should take into account limits for request quantity to API.  

Table of Contents

Description of Data Structures 

Expand
titleResource call_stat

Resource call_stat 

Name 

Type 

Mandatory 

Description 

answered 

long 

yes

Quantity of answered calls 

bridged 

long 

yes

Calls connected to the end subscriber. Difference from answered: the call may be answered, but without connecting to the end subscriber (for example, the call was accepted by the queue, but nobody was able to accept it, then the call is answered, but bridged

bridged_duration 

long 

yes

Total duration of the bridged calls, in seconds 

busy 

long 

yes

Quantity of calls declined with "busy" signal 

duration 

long 

yes

Total duration of the answered calls, in seconds 

failed 

long 

yes

Calls declined for other reasons (not busyrejected, or not answered

not answered 

long 

yes

Quantity of calls that were not answered 

rejected 

long 

yes

Quantity of calls declined by the callee 

total 

long 

yes

Total quantity of calls 

Example 

Get summary data for the first 10 days of November 2019: 

Tabs
[{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"In the "},{"type":"text","text":"authentication ","marks":[{"type":"strong"}]},{"type":"text","text":"section enter the "},{"type":"text","text":"Application_ID","marks":[{"type":"strong"}]},{"type":"text","text":" and "},{"type":"text","text":"Application_Secret","marks":[{"type":"strong"}]},{"type":"text","text":" values obtained during the application registration in the "},{"type":"text","text":"client_id ","marks":[{"type":"strong"}]},{"type":"text","text":"and "},{"type":"text","text":"client_secret","marks":[{"type":"strong"}]},{"type":"text","text":" fields, then click on the \""},{"type":"text","text":"Try it out!","marks":[{"type":"strong"}]},{"type":"text","text":"\" button. If the application data is correct, an access token ("},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":") will be returned in response. The received access token should be entered into the \""},{"type":"text","text":"Access Token Field","marks":[{"type":"strong"}]},{"type":"text","text":"\" at the top of the page and saved by clicking the \""},{"type":"text","text":"Set Token","marks":[{"type":"strong"}]},{"type":"text","text":"\" button."}]},{"type":"table","attrs":{"isNumberColumnEnabled":false,"layout":"default"},"content":[{"type":"tableRow","content":[{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Method","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Resourse","marks":[{"type":"strong"}]}]}]},{"type":"tableHeader","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"Data","marks":[{"type":"strong"}]}]}]}]},{"type":"tableRow","content":[{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"GET"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":"/client/@me/calls/stats/?start_datetime=2019-11-01%2000%3A00%3A00&end_datetime=2019-11-10%2000%3A00%3A00"}]}]},{"type":"tableCell","attrs":{},"content":[{"type":"paragraph","content":[{"type":"text","text":" "}]},{"type":"paragraph","content":[{"type":"text","text":" "}]}]}]}]},{"type":"paragraph","content":[]}]},"id":"fbcac80c-fc9c-4e9c-940d-05c10e8c99d8","label":"Interactive API Browser","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"To send requests using the cURL program, set the values of the "},{"type":"text","text":"url ","marks":[{"type":"strong"}]},{"type":"text","text":"and "},{"type":"text","text":"access_token","marks":[{"type":"strong"}]},{"type":"text","text":" variables:"}]},{"type":"paragraph","content":[{"type":"text","text":"export url=\"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(where the hostname — is the hostname of the API-server provider of IP-telephony),"}]},{"type":"paragraph","content":[{"type":"text","text":"export access_token=\"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"text","text":" "},{"type":"hardBreak"},{"type":"text","text":"(the received access token)."}]},{"type":"paragraph","content":[{"type":"text","text":"Send a request:"}]},{"type":"codeBlock","attrs":{"language":"shell"},"content":[{"type":"text","text":"curl \\\n-H \"Authorization: Bearer ${access_token}\" \\\n-X GET \"${url}/client/@me/calls/stats/?start_datetime=2019-11-01%2000:00:00&end_datetime=2019-11-10%2000:00:00\""}]}]},"id":"101618db-01f2-4fd1-9395-00decf6bb46d","label":"cURL Program","type":"tab"},{"content":{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"To send requests in Python, set the values of the variables URL and ACCESS_TOKEN:"}]},{"type":"paragraph","content":[{"type":"text","text":"URL = \"https://<hostname>/api/ver1.0\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(where the hostname — is the hostname of the API-server provider of IP-telephony),"}]},{"type":"paragraph","content":[{"type":"text","text":"ACCESS_TOKEN = \"8SNsrS0jV35vfmKqKeKtRrHfpbg4UX\"","marks":[{"type":"code"}]},{"type":"hardBreak"},{"type":"text","text":"(the received access token)."}]},{"type":"codeBlock","attrs":{"language":"python"},"content":[{"type":"text","text":"#!/usr/bin/python\n\nimport requests\n\nurl = f'{URL}/client/@me/calls/stats/?start_datetime=2019-11-01%2000%3A00%3A00&end_datetime=2019-11-10%2000%3A00%3A00'\nheaders = {\n    'Authorization': f'Bearer {ACCESS_TOKEN}'\n}\nresponse = requests.get(url, headers=headers)\nprint(response.text)"}]}]},"id":"03e54838-e6bc-49b9-a3bd-5ffa35bc16cc","label":"In Python3","type":"tab"}]

 

Expand
titleSystem response:
Code Block
languagejson
{
  "in": {
    "busy": 0,
    "bridged_duration": 6142,
    "answered": 15,
    "not answered": 5,
    "rejected": 0,
    "failed": 8,
    "bridged": 59,
    "duration": 6386,
    "total": 87
  },
    "out": {
    "busy": 0,
    "bridged_duration": 958,
    "answered": 0,
    "not answered": 37,
    "rejected": 0,
    "failed": 22,
    "bridged": 87,
    "duration": 958,
    "total": 146
  }
}

"Client" Section Resources 

Expand
titleGET /client/{client_id}/calls/stats/

GET /client/{client_id}/calls/stats/ 

URL Options 

Name 

Type 

client_id 

string 

Request Options 

Name 

Type 

start_datetime 

string 

end_datetime 

string 

extension_id 

Array[integer] 

Response Fields 

Name 

Type 

Mandatory 

Description 

in 

call_stat 

no 

Summary data on incoming calls 

out 

call_stat 

no 

Summary data on outgoing calls 

Resource call_stat 

Name 

Type 

answered 

long 

bridged 

long 

bridged_duration 

long 

busy 

long 

duration 

long 

failed 

long 

not answered 

long 

rejected 

long 

total 

long