User Tools

Site Tools


api:pbx:cdrstats

API : PBX : CDR Statistics

Request

This request returns call statistics for employees.

URL https://api.telecomx.dk/pbx/cdrstats
Method POST
Access level VIEWER, MANAGE, OWNER if calls belongs to the customer
RESELLER if customer belongs to the reseller
or ADMIN.
Body customer Id [optional] Customer the calls belongs to, defaults to users own customer.
employee Id [optional] Employee to show statistics for. Defaults to all.
employees Array [optional] List of ids of employees to show statistics for. Defaults to all.
from Date [optional] Date and time from which to collect calls. Default from today at 00:00.
to Date [optional] Date and time until which to collect calls. Default until today at 23:59:59.
ignoreBelow Number [optional] Ignore calls which are shorter than this number of seconds.
ignoreLocal Boolean [optional] Ignore calls which are local (between extensions).
direction String [optional] Direction of calls to include: IN, OUT or BOTH. Defaults to BOTH.
groupingInterval String [optional] How to group results - by MONTH, WEEK, DAY or HOUR. Defaults to DAY.
fields String [optional] Fields to include in the response:
employeeId - Id of employee
employeeName - name of employee
extensionId - Id of extension
extensionNumber - extension number
outboundCalls - number of outbound calls
outboundSeconds - number of outbound seconds
outboundAnswered - number of outbound calls that was answered
outboundUnanswered - number of outbound calls that was not answered
outboundFailed - number of outbound calls that failed
inboundCalls - number of inbound calls
inboundSeconds - number of inbound seconds
inboundAnswered - number of inbound calls that was answered
inboundUnanswered - number of inbound calls that was not answered
inboundBusy - number of inbound calls that was not answered because the callee was busy
sort String [optional] Field to sort by: employeeName, extensionNumber. Field must be included in output.
format String [optional] Data format: JSON, CSV, EXCEL. Defaults to JSON.

Query examples

{
  customer: '12345678901234567890ABCD',
  employees: ['12345678901234567890AAAA','12345678901234567890BBBB'],
  from: '2020-01-01-T00:00:00.000Z',
  to: '2020-01-31T00:00:00.000Z',
  ignoreBelow: 10,
  ignoreLocal: true,
  direction: 'BOTH',
  groupingInterval: 'DAY',
  fields: ['employeeName','extensionNumber','inboundCalls','outboundCalls'],
  sort: 'extensionNumber',
  format: 'JSON'
}

Response

Array of objects, each with the statistics for an employee.

JSON object
employeeId Id Id of employee.
employeeName String Name of employee.
extensionId Id Id of extension.
extensionNumber String Extension number.
data Object Statistics data.
data.<interval> Number Interval is according to groupingInterval setting either a month, a week number, a day or an hour.
data.<interval>.outboundCalls Number Number of outbound calls.
data.<interval>.outboundSeconds Number Number of outbound call seconds.
data.<interval>.outboundAnswered Number Number of outbound calls that was answered.
data.<interval>.outboundUnanswered Number Number of outbound calls that was not answered.
data.<interval>.outboundFailed Number Number of outbound calls that failed (invalid number or error).
data.<interval>.inboundCalls Number Number of inbound calls.
data.<interval>.inboundSeconds Number Number of inbound call seconds.
data.<interval>.inboundAnswered Number Number of inbound calls that was answered.
data.<interval>.inboundUnanswered Number Number of inbound calls that was not answered.
data.<interval>.inboundBusy Number Number of inbound calls that was not answered because the callee was busy.

Example

[
    {
        "employeeId": "5450f1834b75ff21032563a1",
        "employeeName": "Bo Madsen",
        "extensionId": "5bf2b81b462b727cd09b05cd",
        "extensionNumber": "232",
        "data": {
            "49": {
                "outboundCalls": 80,
                "outboundSeconds": 14276,
                "outboundAnswered": 66,
                "outboundUnanswered": 14,
                "outboundFailed": 0,
                "inboundCalls": 111,
                "inboundSeconds": 27041,
                "inboundAnswered": 0,
                "inboundUnanswered": 9,
                "inboundBusy": 0
            },
            "50": {
                "outboundCalls": 106,
                "outboundSeconds": 33521,
                "outboundAnswered": 85,
                "outboundUnanswered": 21,
                "outboundFailed": 0,
                "inboundCalls": 159,
                "inboundSeconds": 45536,
                "inboundAnswered": 0,
                "inboundUnanswered": 3,
                "inboundBusy": 0
            },
            "51": {
                "outboundCalls": 58,
                "outboundSeconds": 13651,
                "outboundAnswered": 39,
                "outboundUnanswered": 19,
                "outboundFailed": 0,
                "inboundCalls": 77,
                "inboundSeconds": 11903,
                "inboundAnswered": 0,
                "inboundUnanswered": 5,
                "inboundBusy": 0
            }
        }
    },
    {
        "employeeId": "53da4c7552b2dbf05521c09b",
        "employeeName": "Benny Andersen",
        "extensionId": "5c5a97d983a3bc74d5891c51",
        "extensionNumber": "289",
        "data": {
            "49": {
                "outboundCalls": 71,
                "outboundSeconds": 8685,
                "outboundAnswered": 63,
                "outboundUnanswered": 8,
                "outboundFailed": 1,
                "inboundCalls": 63,
                "inboundSeconds": 9269,
                "inboundAnswered": 0,
                "inboundUnanswered": 11,
                "inboundBusy": 1
            },
            "50": {
                "outboundCalls": 114,
                "outboundSeconds": 17523,
                "outboundAnswered": 96,
                "outboundUnanswered": 18,
                "outboundFailed": 0,
                "inboundCalls": 83,
                "inboundSeconds": 11317,
                "inboundAnswered": 0,
                "inboundUnanswered": 20,
                "inboundBusy": 0
            },
            "51": {
                "outboundCalls": 66,
                "outboundSeconds": 14204,
                "outboundAnswered": 60,
                "outboundUnanswered": 6,
                "outboundFailed": 0,
                "inboundCalls": 47,
                "inboundSeconds": 5206,
                "inboundAnswered": 0,
                "inboundUnanswered": 15,
                "inboundBusy": 5
            }
        }
    },
    {
        "employeeId": "534bf567221eb20000136767",
        "employeeName": "Hans Hansen",
        "extensionId": "5c5aa35183a3bc74d5891cd1",
        "extensionNumber": "302",
        "data": {
            "49": {
                "outboundCalls": 40,
                "outboundSeconds": 9652,
                "outboundAnswered": 36,
                "outboundUnanswered": 4,
                "outboundFailed": 0,
                "inboundCalls": 36,
                "inboundSeconds": 9038,
                "inboundAnswered": 0,
                "inboundUnanswered": 8,
                "inboundBusy": 3
            },
            "50": {
                "outboundCalls": 73,
                "outboundSeconds": 31671,
                "outboundAnswered": 66,
                "outboundUnanswered": 7,
                "outboundFailed": 0,
                "inboundCalls": 91,
                "inboundSeconds": 17661,
                "inboundAnswered": 0,
                "inboundUnanswered": 22,
                "inboundBusy": 8
            },
            "51": {
                "outboundCalls": 42,
                "outboundSeconds": 13548,
                "outboundAnswered": 31,
                "outboundUnanswered": 11,
                "outboundFailed": 0,
                "inboundCalls": 62,
                "inboundSeconds": 7571,
                "inboundAnswered": 0,
                "inboundUnanswered": 16,
                "inboundBusy": 5
            }
        }
    }
]

Errors

Error code Message Description
422 format Invalid format
422 from Invalid date range
422 groupingInterval Invalid grouping interval - use MONTH, WEEK, DAY or HOUR
403 access_denied Insufficient access level
500 internal_error <Unspecified>
api/pbx/cdrstats.txt · Last modified: 2020/12/23 08:40 by Per Møller

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki