Ordering a phone call via API MANGO
The last notes
All English-language materials have been translated fully automatically using the Google service
Order a phone call via API MANGO
$api_key = '';
$api_salt = '';
$url = 'https://app.mango-office.ru/vpbx/commands/callback_group';
$data = array(
"command_id" => "ID". rand (10000000.99999999),
"from" => $ phone1, // <- internal group number
"to" => $ phone2, // <- who to call (client number)
"line_number" => $ phone3 // <- line number (ANI)
);
$json = json_encode($data);
$sign = hash('sha256', $api_key . $json . $api_salt);
$postdata = array(
'vpbx_api_key' => $api_key,
'sign' => $sign,
'json' => $json
);
$post = http_build_query($postdata);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
curl_close($ch);
$resp=json_decode($response);
// Only a response of 1000 means that the request was successful
// Other response codes indicate errors
if($resp->result===1000){
//Если успешно проводим действия над вызовом, например, сообщаем об успехе
}
This method may fail when ordering a dial-up to Beeline numbers. In this case, it is worth connecting the fmc
service. Then the calling code will look like this:
$url = 'https://app.mango-office.ru/vpbx/commands/callback';
$data = array(
"command_id" => "ID" . rand(10000000,99999999),
"from" => array(
"extension" => '100', // employee ID with fmc connected
"number" => 'fmc:79660088514'// The number of the employee from which the call will go (fmc)
),
"to_number" => $phone2, // Number where to call
//"line_number" => $phone3
);
Comments