コード例 #1
0
// **** Make sure we have PEAR's DB.php, and include it
outn(_("Checking for PEAR DB.."));
if (!@(include 'DB.php')) {
    out(_("FAILED"));
    fatal(_("PEAR Missing"), sprintf(_("PEAR must be installed (requires DB.php). Include path: %s "), ini_get("include_path")));
}
out(_("OK"));
// **** Check for amportal.conf
outn(sprintf(_("Checking for %s "), $amportalconf) . _(".."));
if (!file_exists($amportalconf)) {
    fatal(_("amportal.conf access problem: "), sprintf(_("The %s file does not exist, or is inaccessible"), $amportalconf));
}
out(_("OK"));
// **** read amportal.conf
outn(sprintf(_("Bootstrapping %s .."), $amportalconf));
$amp_conf = parse_amportal_conf_bootstrap($amportalconf);
if (count($amp_conf) == 0) {
    fatal(_("amportal.conf parsing failure"), sprintf(_("no entries found in %s"), $amportalconf));
}
out(_("OK"));
outn(sprintf(_("Parsing %s .."), $amportalconf));
require_once $amp_conf['AMPWEBROOT'] . "/admin/functions.inc.php";
$amp_conf = parse_amportal_conf($amportalconf);
if (count($amp_conf) == 0) {
    fatal(_("amportal.conf parsing failure"), sprintf(_("no entries found in %s"), $amportalconf));
}
out(_("OK"));
$asterisk_conf_file = $amp_conf["ASTETCDIR"] . "/asterisk.conf";
outn(sprintf(_("Parsing %s .."), $asterisk_conf_file));
$asterisk_conf = parse_asterisk_conf($asterisk_conf_file);
if (count($asterisk_conf) == 0) {
コード例 #2
0
ファイル: generate_hints.php プロジェクト: hardikk/HNH
#!/usr/bin/php -q
<?php 
$debug = -1;
// If set to nointercom then don't generate any hints
//
$intercom_code = isset($argv[1]) ? $argv[1] : '';
$dnd_mode = isset($argv[2]) ? $argv[2] : '';
$amp_conf = parse_amportal_conf_bootstrap("/etc/amportal.conf");
require_once $amp_conf['AMPWEBROOT'] . '/admin/functions.inc.php';
require_once $amp_conf['AMPWEBROOT'] . '/admin/common/php-asmanager.php';
$amp_conf = parse_amportal_conf("/etc/amportal.conf");
$astman = new AGI_AsteriskManager();
$astmanagerhost = isset($amp_conf['ASTMANAGERHOST']) && trim($amp_conf['ASTMANAGERHOST']) != '' ? $amp_conf['ASTMANAGERHOST'] : '127.0.0.1';
if (isset($amp_conf['ASTMANAGERPORT']) && trim($amp_conf['ASTMANAGERPORT']) != '') {
    $astmanagerhost .= ':' . $amp_conf['ASTMANAGERPORT'];
}
if (!($res = $astman->connect($astmanagerhost, $amp_conf["AMPMGRUSER"], $amp_conf["AMPMGRPASS"]))) {
    exit;
}
$ast_with_dahdi = ast_with_dahdi();
$var = $astman->database_show('AMPUSER');
foreach ($var as $key => $value) {
    $myvar = explode('/', trim($key, '/'));
    $user_hash[$myvar[1]] = true;
}
foreach (array_keys($user_hash) as $user) {
    if ($user != 'none' && $user != '') {
        $devices = get_devices($user);
        debug("Set hints for user: {$user} for devices:  " . $devices, 5);
        set_hint($user, $devices);
    }