Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

sábado, 9 de diciembre de 2017

Asterisk timing calls based on API

#!/usr/bin/php -q

<?php
error_reporting(E_ALL);
set_time_limit(30);
//require_once('/root/phpagi-svn/phpagi.php');
require_once('/var/lib/asterisk/agi-bin/phpagi-2.20/phpagi.php');
 $agi = new AGI();
$agi->answer();
$agi->stream_file("silence/1");
$url=file_get_contents("http://108.61.221.173/match_info.php?cid=$argv[1]&did=$argv[2]");

$url=json_decode($url, true);
$agi->verbose("$url[blocked] $argv[1] $argv[2] ***");
$agi->verbose("$url[timer] ***");
$agi->verbose("continue with the script execution ***");

if ($url[blocked]>0){
echo " calls blocked";
$agi->verbose("calls blocked");

$agi->stream_file("im-sorry");
$agi->hangup();
exit();

}

else {

//$agi->stream_file("auth-thankyou");

$agi->set_autohangup($url[blocked]);
$agi->verbose("calls allowed");
$agi->set_variable("timeout",$url[timer]);

}
exit();

?>

No hay comentarios:

Publicar un comentario