Wait until event socket is ready then connect to it.

If FreeSWITCH is not started yet then wait to connect to it then
This commit is contained in:
FusionPBX 2022-08-26 12:05:28 -06:00 committed by GitHub
parent b8f1eb7f10
commit 2ca336e956
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -143,14 +143,18 @@
*/
//reconnect to event socket
if (!$socket) {
echo "Not connected to even socket\n";
if (!$socket->connected()) {
//echo "Not connected to even socket\n";
if ($socket->connect($event_socket_ip_address, $event_socket_port, $event_socket_password)) {
$cmd = "event json ALL";
$result = $socket->request($cmd);
echo "Re-connected to event socket\n";
}
else {
echo "Unable to connect to event socket\n";
break;
//sleep and then attempt to reconnect
sleep(1);
continue;
}
}