Php文件(demo.Php(;
#!/usr/bin/php -q
<?php
set_time_limit(0);
ini_set('max_execution_time', 0);
require('phpagi.php');
$agi = new AGI();
$timeParameter = $argv[1];
$agi->verbose("................Demo.......................");
sleep((int)$timeParameter*100);
$agi->verbose("................Demo1.......................");
?>
拨号计划;
[demo_3]
exten => 003,1,AGI(demo.php,3)
[demo_4]
exten => 004,1,AGI(demo.php,4)
我需要多个执行demo.php异步,我应该在需要的时候关闭特定的chanel。我打电话时没问题003@demo从控制台。
asterisk -rx "console dial 003@demo_3" //it is running but not running with multiple
asterisk -rx "console dial 003@demo_3" // it is running
asterisk -rx "console dial 004@demo_4" // but it is not running with async
我该怎么办?我尝试从Extension调用。但是php没有等待400秒。php在30秒后完成。例如
Extension:104
asterisk -rx "channel originate local/003@demo_3 extension 104@from-internal"
asterisk -rx "channel originate local/004@demo_4 extension 104@from-internal"
asterisk -rx "channel request hangup local/003@demo_3" // I can run it when I want
AGI不是异步接口,无法将其用作异步。
您可以使用AMI或ARI。
在AGI中,您应该使用Wait((。在大多数情况下,您应该先接听电话,否则对方的振铃超时将关闭通道。