<?php
require('/var/lib/asterisk/agi-bin/phpagi-2.20/phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
$cid = $agi->parse_callerid();
//$agi->exec("sayalpha","$cid[username]");
$agi->exec("playback","agent-loginok");
$arr=array();
$extension_list=array(100=>100,101=>101,102=>102,103=>103,104=>104,105=>105,106=>106,107=>107,108=>108,109=>109);
foreach($extension_list as $key=> $extension) {
$output = shell_exec("asterisk -x \" core show hint $extension\" | awk '{print $4}' | awk 'NR==1'");
$state = substr("$output", -5);
$state=trim ($state);
if($state=="Idle") {
$arr[]=$key;
}
}
$total_of_agents= count($arr);
$agi->exec("saynumber","$total_of_agents");
///
$extension_list=array(100=>100,101=>101,102=>102,103=>103,104=>104,105=>105,106=>106,107=>107,108=>108,109=>109);
foreach($extension_list as $key=> $extension) {
$output = shell_exec("asterisk -x \" core show hint $extension\" | awk '{print $4}' | awk 'NR==1'");
$state = substr("$output", -5);
$state=trim ($state);
if($state=="Idle") {
$agi->exec("playback","/var/lib/asterisk/sounds/custom/$key");
$agi->exec("saynumber","$key");
}
}
?>
No hay comentarios:
Publicar un comentario