我试图在调用时让我的 php 脚本循环 10 次,但由于某种原因,它只执行一次,然后挂断/死亡/退出。非常感谢我能得到的任何见解。
for ($i=1; $i<=10; $i++)
ob_implicit_flush(true);
require_once('phpagi.php');
$agi = new AGI();
$agi->answer();
list ($id,$number,$callerid) = mysql_fetch_row(mysql_query("select `called`,`tollfree`,`callerid` from `avotfmaster`.`cdr` where `pbx`='0' order by `mins` desc, rand() limit 1",$xb));
if($id) {
$agi->set_callerid("$callerid");
$agi->exec('DIAL',"SIP/31282200*$number@sip.abc.com,40,L(60000)");
$gwopt_dtmf = $agi->get_data('confirm', 3000, 1);
if($gwopt_dtmf['result']==1)
{
mysql_query("UPDATE `avotfmaster`.`cdr` SET `pbx`='1' WHERE `number`='$number'",$xb);
} else {
mysql_query("UPDATE `avotfmaster`.`cdr` SET `pbx`='2' WHERE `number`='$number'",$xb);
$agi->verbose("I will go ahead and mark this number already scanned and tested");
}
}
}