http://<domain_name>/api/voice/fetch_report.php?username=<username>&token=<token>&unique_ids=<unique_ids>
Fetch Voice Report API through Sarv
<?php
try {
$post_url = "http://your_domain/api/voice/fetch_report.php";
$ARR_POST_DATA = array();
$ARR_POST_DATA['username'] = 'your_username';
$ARR_POST_DATA['token'] = "your_token";
$ARR_POST_DATA['unique_ids'] = "unique_id1,unique_id2"; // comma (,) seperated
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $post_url);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($ARR_POST_DATA));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
echo $response;
$arr_response = json_docode($response, true);
var_dump($arr_response);
curl_close($curl);
} catch (Sarv_Error $e) {
// Sarv errors are thrown as exceptions
echo "A sarv error occurred: " . get_class($e) . " - " . $e->getMessage();
}
?>
{
"status":"success",
"code":"000",
"desc":"Request Submitted Successfully",
"data":{
"5950_3_10-u1":{
"status":"success",
"desc":"unique id fetched found",
"data":{
"status":"Dialed",
"report":"Congession",
"contact_number":"9782XXXXXX",
"duration":"0",
"time_start":"10-Oct-2017 2:34:58 PM",
"time_connect":"10-Oct-2017 2:35:11 PM",
"time_end":"10-Oct-2017 2:35:11 PM",
"dtmf":""
}
},
"5950_4_10-u1":{
"status":"success",
"desc":"unique id fetched found",
"data":{
"status":"Dialed",
"report":"Answered",
"contact_number":"8947XXXXXX",
"duration":"1",
"time_start":"10-Oct-2017 2:34:52 PM",
"time_connect":"10-Oct-2017 2:34:57 PM",
"time_end":"10-Oct-2017 2:34:58 PM",
"dtmf":""
}
},
"abcd":{
"status":"error",
"desc":"invalid unique id",
}
}
}
{
"status":"error",
"code":"001",
"desc":"Parameter Missing"
}
Parameters |
username* string |
a valid Sarv SMS Panel User Name |
token* string |
a valid token |
unique_ids* string |
comma (,) seperated unique ids ( Ex : unique_id1,unique_id2 ) |
* compulsory field
Return Value: Success |
struct |
the results of Fetch Voice Report API
status string |
success |
code string |
000 |
desc array |
array of unique ids and respective results.
Unique Id(key) |
status |
desc |
123_21_XX |
success |
data found |
123_22_XX |
error |
Invalid Unique Id |
|
|
|
Return Value: Error |
struct |
the error results when Fetch Voice Report API
status string |
error |
code string |
007 |
desc string |
Invalid announcement type (mp3 allowed only) |
|
|
Api Response Codes |
000 |
Announcement Uploaded Successfully. |
001 |
Parameter Missing . |
002 |
Parameter is blank. |
003 |
Request IP not added in whitelist . |
004 |
Invalid user type. |
005 |
Invalid Credentials. |
006 |
User is InActive. |
019 |
Exceeded unique ids limit for single api call . |