Commo API - API for getting call records
Interface description
the interface for the customer to actively pull the list of call records.
Request method
POST, form-data format
Get call record interface request parameters
| parameter name | type | Is it necessary | illustrate |
|---|---|---|---|
| service | string | yes | App.Sip_Cdr.GetBill |
| token | string | yes | The token obtained through the authorization interface |
| starttime | string | yes | (Dial) start time, format:yyyy-mm-dd hh:mm:ss |
| endtime | string | yes | (Dial) end time, format:yyyy-mm-dd hh:mm:ss |
| syncflag | int | yes | Get record type: 1. Get unqueried records (default); 2. Get queried records; 3. Get all records. |
| direction | int | yes | Call direction: 1. Incoming; 2. Outgoing; 3. All (default). |
| callmethod | int | yes | Call method: 0, unlimited; 1, mutual extension dial; 2, extension direct dial (manual dial); 3, API call (default); 4, API double call; 5, predictive outbound call; 6, IVR/group call . |
| currentpage | int | yes | number of pages, default: 1 |
| itemsperpage | int | yes | Number per page, default: 10, minimum: 1; maximum: 1000 |
| extnumber | string | yes | Extension number, multiple extension numbers are separated by English commas, when passing a null value, it is all |
| destnumber | string | yes | The target number of the call, when passing a null value, it is all |
| userid | string | yes | Custom data (employee ID), nullable |
| memberid | string | yes | Custom data (member ID), can be empty |
| chengshudu | string | no | Custom Data (Maturity) |
| customuuid | string | no | Custom Data (Customer ID) |
API Request Example for Obtaining Call Records(PHP)
<?php
$apiUrl = 'http://127.0.0.1:8080';
$postFields = [
'service' => 'App.Sip_Cdr.GetBill',
'token' => 'ABCDEFG',
'starttime' => '2019-01-12 00:00:00',
'endtime' => '2020-12-12 00:00:00',
'direction' => 3
'syncflag' => 3,
'callmethod' => 0,
'currentpage' => 1,
'itemsperpage' => 10,
];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $apiUrl);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postFields);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($curl);
$curlError = curl_error($curl);
curl_close($curl);
var_dump($response);
?>
return data structure example
{
"ret": 200,
"data": {
"status": 0,
"desc": "get success",
"result": {
"totalitems": 8151,
"currentpage": 1,
"itemsperpage": 10,
"bills": [
{
"id": 22670,
"extnumber": "",
"destnumber": "13387525701",
"displaynumber": "2190170001",
"starttime": "2019-09-27 14:58:37",
"answertime": null,
"endtime": "2019-09-27 14:59:05",
"duration": 28,
"billsec": 0,
"direction": "callout",
"callmethod": 6,
"userid": "0",
"memberid": "0",
"chengshudu": "0",
"customuuid": "0",
"recordfilename": "",
"downloadip": "",
"hangupdirection": 10041,
"hangupcause": 10020,
"userkey":"#"
}
]
},
"reqtime": 1581502410,
"rsptime": 1581502410
},
"msg": ""
}
Return parameter description
| parameter name | type | illustrate |
|---|---|---|
| result | objest | returned result set |
| —totalitems | int | total number of records |
| —currentpage | int | current page number |
| —itemsperpage | int | Quantity per page |
| —bills | array | record array |
| ——id | int | record id |
| ——extnumber | string | Ext |
| ——destnumber | string | target number |
| ——displaynumber | string | display number |
| ——starttime | string | call time |
| ——answertime | string | response time |
| ——endtime | string | call end time |
| ——duration | int | call waiting time |
| ——billsec | int | call time |
| ——direction | string | call direction |
| ——callmethod | int | call method |
| ——userid | string | Custom parameter (user id) |
| ——memberid | string | Custom parameters (member id) |
| ——chengshudu | string | Custom parameters (maturity) |
| ——customuuid | string | Custom parameters (customer id) |
| ——recordfilename | string | call log file name |
| ——downloadip | string | download ip |
| ——hangupdirection | int | hang up directions |
| ——hangupcause | int | hang up reason |
| ——userkey | string | user button |
Postman Example request parameters
