我在 php 中为我的星号 11.3.0 创建了一个 agi,当我在服务器中使用 ps ux 时,我几乎没有 agi 调用卡在队列中,它显示
6:42 /usr/bin/php -q /var/lib/asterisk/agi-bin/php/myagi.php Unknown 190090
许多像这样的进程卡在队列中。
所有带有数字的过程
0:00 /usr/bin/php -q /var/lib/asterisk/agi-bin/php/myagi.php 954332 190053
如果来自未知号码的呼叫,我需要知道如何调试我的 agi。
我的 AGI 脚本
#!/usr/bin/php -q
<?php
pcntl_signal(SIGHUP, SIG_IGN);
require('phpagi/phpagi.php');
$agi = new AGI();
$calleridnum = $agi->request['agi_callerid'];
$callerid = $agi->request['agi_callerid'];
$callidname = $agi->request['agi_calleridname'];
$phoneno = $agi->request['agi_dnid'];
$channel = $agi->request['agi_channel'];
$uniqueid = $agi->request['agi_uniqueid'];
if(substr($phoneno,0,3)==011)
{
$phoneno = substr($phoneno, 3);
}
$URL = '12121@mysip.abc.com';
$dialstr = "SIP/" . $URL;
$res = $agi->exec("DIAL $dialstr");
$dialstatus = $agi->get_variable("DIALSTATUS");
$answeredtime = $agi->get_variable("ANSWEREDTIME");
if($dialstatus['data'] != "ANSWER")
{
//No answer
}
if($dialstatus['data'] == "ANSWER")
{
$agi->verbose("I am in Cutting Balance!!");
}
savecdr($URL,"$callerid", $phoneno, $trunk, $dialstatus['data'], $answeredtime['data'], $PerMinuteCharges,$callstart,$TriggerCharge,$OID,$callidname,$IP,$NodeID,$MinutesUsed,$TalkTime,$TTCut,$pTTRemain,$pHash[Expiry],$pMinTotal,$VOID);
$agi->hangup();
?>