2011年10月31日 星期一

asterisk agi

#!/usr/bin/php -q

require_once('phpagi.php');
require_once('phpagi-asmanager.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
$agi->stream_file('welcome','#');
do
{
  $agi->stream_file("enter-some-digits","#");
  $result = $agi->get_data('beep', 3000, 20);
  $keys = $result['result'];
  if (trim($keys)!=""){
    $agi->stream_file("pls-wait-connect-call","#");
    $agi->say_digits($keys);
    $agi->exec_dial("DAHDI/1","$keys","60","m");
}
} while($keys != '111');
$id = $agi->get_data('beep', 4000, 6);
$id = $id['result'];
$agi->hangup();
?>

沒有留言: