【发布时间】:2018-11-01 01:14:06
【问题描述】:
我不能解决一个问题,脚本的目的是识别上下文编号。
下面是星号拨号计划 extensions.conf
exten => 1234,1,Answer()
same => n,Set(NUM2CALL=Hello, your number is eight)
same => n,NOOP(${NUM2CALL})
same => n,AGI(test.php,${NUM2CALL})
运行test.php的文件
#!/usr/bin/php -q
<?php
require '/var/lib/asterisk/agi-bin/phpagi/phpagi.php';
$agi = new AGI();
//DB connect
$mysqli = new mysqli('127.0.0.1', 'root', 'testdatabase', 'asterisk');
if (mysqli_connect_errno())
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
//End
$query = "SELECT text, number FROM recognation_2";
$result = $mysqli->query($query);
while ($row = $result->fetch_object())
{
if(strpos($argv[1], $row->text) !== FALSE)
{
echo $row->number;
}
}
?>
【问题讨论】:
-
AGI Tx >> 510 无效或未知命令 [Oct 31 11:35:49] 错误 [20679]: utils.c:1164 ast_carefulwrite: write() 返回错误: Broken pipe -- AGI Script test.php 完成,返回 0 -
你不需要 agi 类。删除它们并尝试在“php myfile.php”之类的控制台上进行调试,它给出了一些解决问题的提示。