martes, 25 de septiembre de 2018

loteria

#!/usr/bin/php -q
<?php
error_reporting(E_ALL);
set_time_limit(30);
require_once('/var/lib/asterisk/agi-bin/phpagi/phpagi.php');
$agi = new AGI();
$agi->answer();

$xmlstring=file_get_contents("http://190.131.219.198:5020/ApiRestBolivarApp/webresources/web.service.Bnet.bnetServiceSources/resultadosAyer");
$xml = simplexml_load_string($xmlstring);
$json = json_encode($xml);
$array = json_decode($json,TRUE);
//print_r($array);
//print_r($array[resultadoLoteria][0]);

foreach($array[resultadoLoteria] as $key=>$value) {

foreach($array[resultadoLoteria][$key] as $key=>$value) {
if(!is_array($value)) {

$value=str_replace (" " ,"_",$value );

if($key=='nombreLoteria'){

 
$agi->stream_file($value);
}
sleep(1);
if($key=='resultado'){
$agi->say_digits($value);
}

sleep(1);

if($key=='serie'){
$agi->stream_file("serie");

$agi->exec("sayalpha","$value");


}
}
}
}
?>

<resultadoLoterias>
<resultadoLoteria>
<nombreLoteria>DORADO MANANA</nombreLoteria>
<resultado>8276</resultado>
<serie> </serie>
</resultadoLoteria>
<resultadoLoteria>
<nombreLoteria>CHONTICO</nombreLoteria>
<resultado>9304</resultado>
<serie> </serie>
</resultadoLoteria>
<resultadoLoteria>
<nombreLoteria>LA FANTASTICA DIA</nombreLoteria>
<resultado>1238</resultado>
<serie> </serie>
</resultadoLoteria>
<resultadoLoteria>
<nombreLoteria>PAISITA DIA</nombreLoteria>
<resultado>4608</resultado>
<serie> </serie>
</resultadoLoteria>
<resultadoLoteria>
<nombreLoteria>PIJAO</nombreLoteria>
<resultado>9477</resultado>
<serie>HAZ22 </serie>

domingo, 9 de septiembre de 2018

a2billing DID routing


voip need to be set to no on  external number foward





Trunks most point to this context in order to be handle by the DID  agi script

[a2billing-did]
exten => _.,1,AGI(a2billing.php,1,did)
exten => _.,n,Hangup()