Filter for specific Events

This commit is contained in:
FusionPBX 2022-09-15 16:01:47 -06:00 committed by GitHub
parent 6f6eb88ebb
commit 4fce9a4565
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 3 deletions

View File

@ -127,6 +127,13 @@
//loop through the switch events
$cmd = "event json ALL";
$result = $socket->request($cmd);
if ($debug) { print_r($result); }
//filter for specific events
$cmd = "filter Event-Name CUSTOM";
$result = $socket->request($cmd);
if ($debug) { print_r($result); }
while (true) {
//check pending unblock requests
@ -148,9 +155,13 @@
if ($socket->connect($event_socket_ip_address, $event_socket_port, $event_socket_password)) {
$cmd = "event json ALL";
$result = $socket->request($cmd);
if ($debug) { print_r($result); }
$cmd = "filter Event-Name CUSTOM";
$result = $socket->request($cmd);
if ($debug) { print_r($result); }
echo "Re-connected to event socket\n";
}
}
else {
//sleep and then attempt to reconnect
sleep(1);
@ -168,7 +179,9 @@
}
//debug info
//view_array($json_array, false);
if ($debug) {
print_r($json_array);
}
//registration failed - block IP address unless they are registered,
if (is_array($json_array) && $json_array['Event-Subclass'] == 'sofia::register_failure') {