api:sip:cdr
Table of Contents
API : SIP CDR
Introduction
This request will return CDR data for the SIP account.
This is a limited view into the CDR records. To access CDR data with all the details, you must access it via the CDR API.
Request
| URL | https://api.telecomx.dk/sip/ACCOUNT_ID/cdr | |
|---|---|---|
| Method | GET | |
| Access level | VIEWER, MANAGER or OWNER if user belongs to the customer. RESELLER if customer belongs to the reseller. ADMIN. |
|
| Param | ACCOUNT_ID | Id of the SIP account (24 hex-char string). |
| Query | fromDate | [optional] Date to start from when returning CDR records. Date format: yyyy-mm-dd. Defaults to today. |
| toDate | [optional] Last date to return CDR records for. Date format: yyyy-mm-dd. |
|
| limit | [optional] Max number of CDR records to return, default 100 (0-1000000). |
|
| offset | [optional] Offset for paging, index of first CDR record to return, default 0 (0-1000000). |
|
| filter | [optional] Search query that looks into A number, B number, users name, users extension. |
|
| direction | [optional] Direction of the call, 'IN', 'OUT' or 'BOTH' (default). |
|
| format | [optional] Format for output: json (default), csv or excel (max. 10000 rows). |
|
Query example
https://api.telecomx.dk/sip/1234567890ABCDEF12345678/cdr https://api.telecomx.dk/sip/1234567890ABCDEF12345678/cdr?fromDate=2014-07-23 https://api.telecomx.dk/sip/1234567890ABCDEF12345678/cdr?fromDate=2014-07-23&toDate=2014-07-31&limit=1000&offset=100&filter=12345678 https://api.telecomx.dk/sip/1234567890ABCDEF12345678/cdr?fromDate=2014-07-23&toDate=2014-07-31&limit=1000000&format=csv
Response
If format is CSV or Excel the response is a file for download. If format is JSON, the below applies.
| JSON object | ||
|---|---|---|
| offset | Number | Index of the first CDR record returned. |
| limit | Number | Number of CDR records to return. Note that the actual number of CDR records returned 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. |
| cdr | Array | Array of CDR records, see definition below. |
| CDR record object (JSON) | ||
|---|---|---|
| _id | Id | Unique id of the CDR record. |
| type | String | Type and direction of the call: SIP_INBOUND, SIP_OUTBOUND, MVNO_INBOUND, MVNO_OUTBOUND. |
| aNumber | String | The number presented by the caller, E.164 format. If the type is SIP_INBOUND or MVNO_INBOUND and the caller is using secret number then the number will be 'HIDDEN'. |
| aNumberSecret | Boolean | True of aNumber is secret and not to be presented. |
| bNumber | String | The number called, E.164 format. If the type is SIP_OUTBOUND or MVNO_OUTBOUND then the user must be RESELLER or ADMIN to see the full number, otherwise the last 2 digits is replaced with 'XX'. |
| diverter | String | If the call is a diverted call, this is the E.164 number of the one who diverted the call. |
| start | Date | Date and time the call started. |
| length | Integer | The length of the call in seconds. |
| terminationCause | String | The reason for the call to end: HANGUP - call hang up BUSY - callee is busy NO_ANSWER - callee did not answer BLACKLISTED - called number is blacklisted BLOCKED - caller is not allowed to call the callee (highrate/international/all blocking) ERROR - call failed NOT_FOUND - callee does not exist FRAUD - call terminated due to fraud |
| terminatedBy | String | Who terminated the call: A = caller, B = callee, S = system. |
| destination.country | String | The ISO3166-2 country code of the destination country. |
| destination.type | String | The type of destination 'fixed', 'mobile', 'special', 'dkspecial'. |
| destination.name | String | If the type is 'dkspecial', the call is towards a danish special number, 112, 114, 1813 etc., and this contains a precise description in danish of the destination (e.g. 1813 Akuttelefonen region hovedstaden). |
| userName | String | Name of the person making the call (if set by PBX). |
| userLocation | String | Location of the person making the call (if set by PBX). |
| userExtension | String | Local extension number of the person making the call (if set by PBX). |
| price | Number | Total price of the call (after rating). |
| callId | String | SIP Call-ID for the call (ADMIN only). |
| sbcServer | String | Session border controller that handled the call (ADMIN only). |
| type | String | Internal call type (ADMIN only). |
If a call originates from a PBX, then the PBX can add SIP headers to the outbound call to indicate the name of the caller, the location of the caller and the local extension number of the caller. These data will automatically be added to the CDR record if available.
Example
{ offset: 0, limit: 100, total: 548, cdr: [ { _id: '1234567890ABCDEF12345678', type: 'SIP_OUTBOUND', aNumber: '+4570305050', bNumber: '+4581808888', diverter: null, start: '2014-07-23T12:34:56.123Z', length: 78, terminationCause: 'HANGUP', terminatedBy: 'B', destination: { country: 'DK', type: 'mobile' }, userName: 'Hans Hansen', userLocation: 'CPH office', userExtension: '211' }, ... ] }
Errors
| Error code | Message | Description |
|---|---|---|
| 400 | bad_request | SIP account id not found in request URI |
| 404 | sipAccount | SIP account not found |
| 409 | format | Limit on Excel format exceeded - max. 10000 rows |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/sip/cdr.txt · Last modified: 2019/04/02 13:06 by Per Møller