本文整理汇总了PHP中AGI_AsteriskManager::Ping方法的典型用法代码示例。如果您正苦于以下问题:PHP AGI_AsteriskManager::Ping方法的具体用法?PHP AGI_AsteriskManager::Ping怎么用?PHP AGI_AsteriskManager::Ping使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AGI_AsteriskManager
的用法示例。
在下文中一共展示了AGI_AsteriskManager::Ping方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date
echo date("Y-m-d H:i:s") . " running " . basename(__FILE__) . PHP_EOL;
include './lib/phpagi/phpagi-asmanager.php';
$manager = new AGI_AsteriskManager();
echo date('Y-m-d H:i:s') . " : Connecting to AMI... ";
if (!$manager->connect($amihost . ":" . $amiport, $amiusername, $amipassword)) {
echo " ...Connection failed.\n";
exit;
} else {
echo " ...Connection established.\n";
$manager->add_event_handler('*', 'dump_events');
}
$manager->wait_response();
$latest_check = 0;
$checkEvery = 10;
// poll every 1 seconds
while ($manager->Ping()) {
if (time() - $latest_check > $checkEvery) {
setGlobal(str_replace('.php', '', basename(__FILE__)) . 'Run', time(), 1);
$latest_check = time();
}
if (file_exists('./reboot') || isset($_GET['onetime'])) {
$manager->disconnect();
$db->Disconnect();
exit;
}
}
DebMes("Unexpected close of cycle: " . basename(__FILE__));
function dump_events($ecode, $data, $server, $port)
{
// Search exist event
$parent_class_rec = SQLSelectOne("SELECT ID FROM classes WHERE TITLE LIKE 'Telephony'");