diff --git a/gen_polycom_directory.php b/gen_polycom_directory.php index 5216a01..7358f8b 100755 --- a/gen_polycom_directory.php +++ b/gen_polycom_directory.php @@ -16,7 +16,7 @@ $bootstrap_settings['freepbx_auth'] = false; require_once('/etc/freepbx.conf'); -$provision_dir = '/tftpboot/directory'; // <-- adjust if needed +$provision_dir = '/tftpboot'; // <-- adjust if needed $out_file = $provision_dir . '/000000000000-directory.xml'; $do_notify = in_array('--notify', $argv, true); @@ -125,15 +125,43 @@ echo "Wrote $out_file with " . $root->childNodes->length . " contacts\n"; /** Optional: push check-sync to re-download directory without reboot */ if ($do_notify) { - // Use the extension list we already built - $notified = 0; - foreach ($rows as $r) { - $ext = trim((string)$r['extension']); - if ($ext === '') continue; - // In FreePBX, PJSIP endpoint id is typically the extension number - $cmd = "asterisk -rx \"pjsip send notify polycom-check-cfg endpoint " . escapeshellarg($ext) . "\""; - exec($cmd, $o, $rc); - if ($rc === 0) $notified++; + $asteriskBin = '/usr/sbin/asterisk'; + + $excludedEndpoints = [ + '101', '102', '103', '104', '105', '106', '107', '108', '109', '110', '111', '112', '113', '114', '900', 'Voyant', '