#!/usr/local/bin/php -q
<?php
require('phpagi.php');
// Play the "Enter the host you wish to ping, followed by the pound sign" prompt
// and then play the beep.
$result =
$agi->get_data('beep', 3000, 20);
/* Danger Will Robinson! This does NOT properly escape the ping command!
* Someone could subvert your system if you don't fix this! - NO WARRANTY :P */
$execstr = "/bin/ping -c 5 -q -w 9 $ip|grep transmitted";
// be polite.
$p =
popen($execstr, 'r');
if($p == FALSE)
{
$agi->conlog("Failed to ping $execstr");
}
else
{
$str = '';
{
if(!$r) break;
$str .= $r;
}
// a minor hack.
// have festival read back the ping results.
}
?>