Download CDR Files

Download CDR files of specific extensions or all extensions.

Steps to download a CDR file

  1. Get the random string of CDR file.
  2. Combine the random string with other parameters to form a download link.
    Note: The random string is only valid for 30 seconds, and each random string can be used only once.

Request URL

{base_url}/{api_path}/cdr/get_random?token={token}

Request parameters

Parameter Required Type Description
number Yes String Extension number, which means which extension's CDR file will be downloaded.

Valid values:

  • An extension number: Download CDR file of the specified extension.

    Example: "number":"1000"

  • Multiple extension numbers : Download CDR files of multiple extensions. Separate multiple extension numbers with ,.

    Example: "number":"1000,1001,1002"

  • all: Download CDR files of all extensions.

    Example: "number":"all"

starttime Yes String Specify the start time to filter the CDR reports.

Time format: yyyy-mm-dd hh:mm:ss

endtime Yes String Specify the end time to filter the CDR reports.

Time format: yyyy-mm-dd hh:mm:ss

allowedip No String

Specify the IP address which is allowed to download CDR file. By default, allowedip is not carried, which means only the application server can download CDR file.

Valid values:

  • Leave the value of allowedip blank: Only the application server can download CDR files.

    Example: "allowedip":" "

  • IP address: Only the application server or a server with this IP address can download CDR files.

    Example: "allowedip":"192.168.5.20"

Response parameters

Parameter Type Description
status String Request result.
  • Success
  • Failed
number String Extension number.
starttime String The start time to filter the CDR reports.
endtime String The end time to filter the CDR reports.
random String A random string for CDR file.

Combine the random string with other parameters to form a download link.

Examples

Request example

Get the random string of CDR file for extension 4000.

POST /api/v2.0.0/cdr/get_random?token=1e3b3ebb6a974cb42ed31de5413df52d
Content-Type:application/json; charset=utf-8
Host: 192.168.5.150

{
	"number": "4000",
	"starttime": "2019-10-24 00:00:00",
	"endtime": "2019-10-24 15:59:59"
}
Response example
HTTP/1.1 200 OK
Server: Boa/0.94.14rc21
Accept-Ranges: bytes
Connection: close
Content-Type: application/json
Access-control-allow-origin: *
Access-control-allow-methods: GET, POST, OPTIONS, PUT, DELETE

{
	"status": "Success",
	"number": "4000",
	"starttime": "2019-10-24 00:00:00",
	"endtime": "2019-10-24 15:59:59",
	"random": "7b5a748e176d1ed625793d3a231808dc"
}

Download Link Example

Use the API responded random as a component of a specified request address for downloading the CDR file.

The CDR file is in CSV format. Check the descriptions of CDR parameters.

Download link format:
https://{pbx ip}:{https port}/api/v2.0.0/cdr/download?number={number}&starttime={starttime}&endtime={endtime}&token={token}&random={random}
Download link example:
https://192.168.5.150:8088/api/v2.0.0/cdr/download?number=4000&starttime=2019-10-24%2000:00:00&endtime=2019-10-24%2015:59:59&token=4555b319609ca31410f7b946671fcc69&random=7b0ad48124d720235b05d2435a48bc30