API - Call Detail Records - CDR Save¶
API CDR se foloseste pentru a salva informatii despre apeluri in centrala
API URL¶
https://[YOUR-PBX-URL]/api/cdr
Datele se trasmit prin POST sau GET si trebuie sa fie de forma:¶
Array
(
[action] => save
[data] => Array
(
[0] => Array
(
[id] => 35097
[comments] => test comment
[accounting_code] => test code 1234
[transcriptions] => Array
(
[0] => Array
(
[type] => monitor
[filename] => 1749628794.686
[provider] => stt_provider
[remote_id] => recording_12345
[text] => Sample transcription text
[metadata] => Array
(
[test_string1] => Good
[another_string2] => Bad
[test_score] => 1
[another_score] => 4
)
)
)
)
)
[api_hash] => 07112231a9c89f5b108af08608a97b07
)
Exemplu generare parametri:
$params = [
'action' => 'save',
'data' => [
[
'id' => 35097,
'comments' => 'test comment', // optional
'accounting_code' => 'test code 1234', // optional
'transcriptions' => [
[
'type' => 'monitor', // 'monitor','recording','confbridge'
'filename' => '1749628794.686', // required
'provider' => 'stt_provider', // required
'remote_id' => 'recording_12345', // required
'text' => 'Sample transcription text',
'metadata' => [
'test_string1' => 'Good',
'another_string2' => 'Bad',
'test_score' => 1,
'another_score' => 4
]
]
]
]
]
];
Exemplu generare hash:
$params['api_hash'] = md5(http_build_query($params) . 'your_api_key'); // make hash
Exemplu trimitere date:
$url = 'https://[YOUR-PBX-URL]/api/cdr';
$token = 'your_api_token';
echo curlPost($url, http_build_query($params), array("Authorization: Bearer {$token}"));
Date trimise JSON¶
{
"action": "save",
"data": [
{
"id": 35097,
"comments": "test comment",
"accounting_code": "test code 1234",
"transcriptions": [
{
"type": "monitor",
"filename": "1749628794.686",
"provider": "stt_provider",
"remote_id": "recording_12345",
"text": "Sample transcription text",
"metadata": {
"test_string1": "Good",
"another_string2": "Bad",
"test_score": 1,
"another_score": 4
}
}
]
}
],
"api_hash": "7645211b387997bd96a8b77f03f6aa91"
}
Raspuns¶
In caz de succes:
{
"has_error": false,
"messages": [],
"results": {
"35097": {
"call_updated": 0,
"transcriptions_ids": [
44
]
}
}
}
Sau in caz de eroare:
{
"has_error": true,
"messages": [
"Required parameter is missing from data array: id"
],
"pagination": [ ],
"results": [ ]
}
Disponibil si in alte limbi: EN