Sarv.com

Voice OTP API

GET : http://<domain_name>/api/voice/voice_broadcast_tts.php?username=<username>&token=<token>&content=<content>&plan_id=<plan_id>&contact_numbers=<contact_number1[,contact_number2,...]>[&caller_id=<caller_id>]
POST : http://<domain_name>/api/voice/voice_broadcast_tts.php;
Post Parameters
username=<username>
token=<token>
content=<content>
plan_id=<plan_id>
caller_id=<caller_id>
contact_numbers=<contact_number1[,contact_number2,...]>

PHP Example:


$post_url = "http://your_domain/api/voice/voice_broadcast_tts.php";

$ARR_POST_DATA = array();

$ARR_POST_DATA['username'] = 'your_username';
$ARR_POST_DATA['token'] = "your_token";
$ARR_POST_DATA['content'] = "Thank you for your valuable feedback";
$ARR_POST_DATA['plan_id'] = 12;
$ARR_POST_DATA['caller_id'] = "1234"; // optional
$ARR_POST_DATA['contact_numbers'] = "1234XXXXXX,6789XXXXXX"; // 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); 

            
Parameters (* compulsory field)
username* string a valid username
token* string a valid token
content* text Enter announcement text
plan_id* string Voice plan_id for sending voice call
caller_id integer Approved caller id
contact_numbers* integer a valid contact number (, seperated for multiple contacts) Max : 50 Contact Numbers

Response

Error Case :

{
"status":"error",
"code":"005",
"desc":"Invalid Credentials"
}

Success Case :

{
"status":"success",
"code":"000",
"desc":"Call Submitted Successfully",
"data":[
{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"system_api_uniqueid":"12X_24X_XX",
},

{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"system_api_uniqueid":"12X_24X_XX",
},

{
"contact_number":"1234XXXXXX",
"unique_id":"12X_24X_XX",
"system_api_uniqueid":"12X_24X_XX",
},
]  
}

Return Value: Error
struct
status string error
code string status codes response code list
desc string description of error
Return Value: Success
struct
status string success
code string status codes response code list
desc string description of success
data array array of contact numbers and respective unique ids.

Api Response Codes

Response Code Description
000 Call Submitted 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
008 Exceeded contact no limit for single api call
010 Invalid caller id
011 Some issue in credit fetch
014 There is no plan assign to parent
015 Voice Amount Validity Expired"
016 Low voice amount to your parent
017 No gateway available for voice broadcast
018 Announcement file not exists on panel
019 Invalid User Voice Plan
020 Caller id is not host on any gateway