merge #2
+10
-11
@@ -125,15 +125,14 @@ echo "Wrote $out_file with " . $root->childNodes->length . " contacts\n";
|
|||||||
|
|
||||||
/** Optional: push check-sync to re-download directory without reboot */
|
/** Optional: push check-sync to re-download directory without reboot */
|
||||||
if ($do_notify) {
|
if ($do_notify) {
|
||||||
// Use the extension list we already built
|
asterisk_bin=/usr/sbin/asterisk
|
||||||
$notified = 0;
|
endpoints=$($asterisk_bin -rx "pjsip show endpoints" \
|
||||||
foreach ($rows as $r) {
|
| sed -n 's/^[[:space:]]*Endpoint:[[:space:]]\+\([^[:space:]/]\+\).*/\1/p' \
|
||||||
$ext = trim((string)$r['extension']);
|
| grep -vE '^(anonymous|system)$' \
|
||||||
if ($ext === '') continue;
|
| sort -u)
|
||||||
// In FreePBX, PJSIP endpoint id is typically the extension number
|
|
||||||
$cmd = "asterisk -rx \"pjsip send notify polycom-check-cfg endpoint " . escapeshellarg($ext) . "\"";
|
for ep in $endpoints; do
|
||||||
exec($cmd, $o, $rc);
|
echo "Sending check-sync to $ep"
|
||||||
if ($rc === 0) $notified++;
|
$asterisk_bin -rx "pjsip send notify polycom-check-cfg endpoint $ep"
|
||||||
}
|
done
|
||||||
echo "Sent check-sync to $notified endpoints\n";
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user