API - Call Detail Records - CDR¶
The API CDR is used to read the PBX call list
API URL¶
https://[YOUR-PBX-URL]/api/cdr
Data is sent via POST or GET and must be of the form:¶
Array ( [page] => 1 [filters] => Array ( [date_between] => Array ( [0] => 2024-01-01 00:00:00 [1] => 2024-01-15 23:59:59 ) [project_id] => [user_id] => [inbound_route_id] => [direction] => [call_status] => [telephone_like] => [telephone] => [source] => [destination] => [hour_between] => [from_id] => [uniqueid] => [linkedid] => [external_id] => [has_transcription] => [has_monitor_file] => [has_recording_file] => ) [api_hash] => 07112231a9c89f5b108af08608a97b07 )
The action parameter must be read. The page parameter's default value is 1, it will need to be incremented to extract the data from all pages.
HTTP Headers:¶
Content-Type: text/xml Authorization: Bearer <token>
Filters:¶
- date_between: the interval for which filtering is performed
- project_id: project ID in PBX
- user_id: User ID in PBX
- inbound_route_id: Inbound routes IDs
- direction: call type: inbound or outbound (IN, OUT)
- call_status: call status (NO ANSWER, CONGESTION, FAILED, BUSY, ANSWERED)
- telephone_like: filter by any phone number (wildcard)
- telephone: filter by any phone number (exact)
- source: the phone number from which the call was initiated
- destination: the telephone number to which the call was initiated
- hour_between: the time interval for which filtering is performed
- from_id: ID start for retrieving information (when the last synchronized ID is retained)
- uniqueid: Call ID
- linkedid: Linked calls ID
- external_id: External ID
Example of parameters generation:
$params = array(
'page' => 1,
'filters' => array(
'date_between' => array('2024-01-01 00:00:00', '2024-01-15 23:59:59'), // array(from, to)
'project_id' => null,
'user_id' => null, // Users IDs
'inbound_route_id' => null, // array(1,2,3,4) Inbound Routes IDs
'direction' => null, // IN, OUT
'call_status' => null, // NO ANSWER, CONGESTION, FAILED, BUSY, ANSWERED
'telephone_like' => null, // Wildcard search for source OR destination
'telephone' => null, // Exact search for source OR destination
'source' => null, // Wildcard search for source
'destination' => null, // Wildcard search for destination
'hour_between' => null, // array(from, to)
'from_id' => null, // >= id
'uniqueid' => null,
'linkedid' => null,
'has_transcription' => null,
'has_monitor_file' => null,
'has_recording_file' => null,
'external_id' => null,
)
);
Example of hash generation:
$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash
Example for data sending:
$url = 'https://[YOUR-PBX-URL]/api/cdr';
$token = 'your_api_token';
echo curlPost($url, http_build_query($params), array("Authorization: Bearer {$token}"));
Answer¶
If successful:
{
"has_error": false,
"messages": [ ],
"pagination": {
"row_count": 0,
"page_size": 100,
"current_page": 0,
"max_page": 0
},
"results": [ ]
}
Or in case of error:
{
"has_error": true,
"messages": [
"Invalid filter: from_idxx"
],
"pagination": [ ],
"results": [ ]
}
Available in other languages: RO
Go to top