api:pbx:cdr
Table of Contents
API : PBX : CDR
Request
This request returns a list of call detail records.
| URL | https://api.telecomx.dk/pbx/cdr | |
|---|---|---|
| Method | GET or POST | |
| Access level | PERSONAL if user received or made the call VIEWER, MANAGE, OWNER if calls belongs to the customer RESELLER if customer belongs to the reseller or ADMIN. |
|
| Query | offset | [optional] Index of the first item to return, default 0. |
| limit | [optional] The number of items to return, default 100, min 1, max 10000. |
|
| filter | [optional] Search query that will match against aNumber, aName, bNumber and bName. |
|
| customer | [optional] Customer the calls belongs to, defaults to users own customer. |
|
| employee | [optional] Employee to show calls for, overridden by extension. |
|
| extension | [optional] Extension to show calls for. |
|
| terminatedBy | [optional] Who terminated the call: A for caller, B for callee or S for system. |
|
| terminatedReason | [optional] How was the call terminated: CANCEL - no answer, cancelled by caller HANGUP - hangup after answered BUSY - callee was busy UNREACHABLE - callee could not be called ERROR - call ended due to an error BLOCKED - call blocked due to suspicion of fraud or blacklisted by user NOT_FOUND - called number does not exist FAILED - any of UNREACHABLE, ERROR, BLOCKED, NOT_FOUND. |
|
| from | [optional] Start date/time to include calls from, defaults to midnight today. |
|
| to | [optional] End date/time to include calls until, defaults to from + 24 hours. |
|
| direction | [optional] Direction of calls to include: IN or OUT. Required extension or that user has access level PERSONAL. |
|
| recording | [optional] True to also include if a call has been recorded. |
|
| answeredByCallee | [optional] True to only return calls that was answered by the callee (not by system/voicemail etc). |
|
| withNote | [optional] True to only return calls with a CDR note. |
|
| format | [optional] Data format: JSON, CSV, EXCEL. Defaults to JSON. |
|
Query examples
https://api.telecomx.dk/pbx/cdr https://api.telecomx.dk/pbx/cdr?customer=1234578901234567890ABCD&extension=12345678901234567890AAAA&terminatedReason=CANCEL&filter=203 https://api.telecomx.dk/pbx/cdr?from=2019-01-01T00:00:00.000Z&to=2019-01-02T00:00:00.000Z
Response
| JSON object | ||
|---|---|---|
| offset | Number | Index of the first CDR returned. |
| limit | Number | Number of CDR records to return. Note that the actual number of returned items may be lower. |
| total | Number | Number of CDR records that can be returned when offset and limit is not considered. This is to be used for paging through the data. |
| cdrs | Array | Array of CDR records, see definition below. |
| CDR (JSON) | ||
|---|---|---|
| _id | Id | Unique ID of call. |
| pbx | String | Hostname of server that handled the call. |
| channelId | String | Name of channel on server. |
| callId | String | SIP Call ID, if available. |
| started | Date | Date and time when the call started. |
| answered | Date | Date and time when the call was answered, null if it was not. |
| answeredByCallee | Boolean | True if call was answered by the callee. False if not answered or answered by system. |
| ended | Date | Date and time when the call ended. |
| customer | Id | Id of customer. |
| terminatedBy | String | Who terminated the call: A for caller, B for callee or S for system. |
| terminatedReason | String | How was the call terminated: CANCEL - no answer, cancelled by caller HANGUP - hangup after answered BUSY - callee was busy UNREACHABLE - callee could not be called ERROR - call ended due to an error BLOCKED - call blocked due to suspicion of fraud or if blacklisted by user NOT_FOUND - called number does not exist |
| cdrNote | String | CDR note as set during the call. |
| caller | Object | Caller data |
| caller.number | String | Callers phone number. |
| caller.name | String | Callers name, if available. |
| caller.extension | Id | Id of extension that made the call, if the call was made on a SIP or MVNO phone. |
| caller.sipPhone | Id | Id of the SIP phone the call was made on. Null if it was not. |
| caller.privacy | Boolean | True if callers number shall be hidden. |
| caller.type | String | Type of caller: EXTERNAL, SYSTEM, SIPPHONE, MOBILE, EXTERNALPHONE. |
| caller.divertedBy | String | If call was diverted, this is the number of the diverter, |
| callee | Object | Callee data |
| callee.number | String | Callees phone number. |
| callee.name | String | Callees name, if available. |
| callee.extension | Id | Id of extension that received the call, if it was received on a SIP or MVNO phone. |
| recording | Array | List of call recordings - if requested and the call was recorded |
| recording[]._id | Id | Id of recording. |
| recording[].by | String | Who recorded the call: EMPLOYEE or COMMON. |
| recording[].employee | Id | Id of employee the recording belongs to, if by is COMMON. |
| recording[].length | Number | Length of recording in seconds. |
| recording[].followUp | Boolean | True if follow up has been set. |
| recording[].followUpNote | String | Follow up note - if any. |
Example
{ "offset": 0, "limit": 100, "total": 7, "cdrs": [ { "_id": "5d035c832d357b369b6f7aff", "pbx": "pbx3.telecomx.dk", "channelId": "1560501368.50818", "callId": "9f09cceff8250a4e", "started": "2019-06-14T08:36:08.791Z", "answered": null, "answeredByCallee": false, "ended": "2019-06-14T08:36:19.523Z", "caller": { "number": "210", "name": "Per Møller", "extension": "5cfd1d10327c3b67a69883c6", "sipPhone": "5c5aaa7a83a3bc74d5891d29" }, "callee": { "number": "432", "name": "Michael Hansen", "extension": "5c52a38ddd7b982b96d4aacc" }, "recording": [ { "_id": "12345678901234567890AAEE", "by": "EMPLOYEE", "employee": "12345678901234567890FEDE", "length": 120, "followUp": true, "followUpNote": "Call back and make invoice" } ], "customer": "52f4fd7734697b28ccaf77ec", "terminatedBy": "A", "terminatedReason": "HANGUP", "cdrNote": "This is a note" }, { ... } ] }
Errors
| Error code | Message | Description |
|---|---|---|
| 404 | extension | Extension not found |
| 403 | extension | Access to extension is denied |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/pbx/cdr.txt · Last modified: 2025/03/27 21:58 by Per Møller