Event socket bug fix and more docs (#6823)

* Add documentation to methods. Use is_resource for added type detection

* Allow connect to specify timeout in microseconds with default 30,000

* Update calling mechanism for event sockets

* Update project for new singleton event sockets

* remove unused variable

* catch errors on closing the socket
This commit is contained in:
frytimo
2023-12-02 17:16:18 -07:00
committed by GitHub
parent 44567f7a05
commit 3a4c2f72e2
74 changed files with 1620 additions and 1533 deletions
@@ -90,10 +90,10 @@
}
//create an event socket connection
$fp = event_socket_create();
$esl = event_socket::create();
//get the call center queue, agent and tiers list
if (!$fp) {
if (!$esl->is_connected()) {
$msg = "<div align='center'>Connection to Event Socket failed.<br /></div>";
echo "<div align='center'>\n";
echo "<table width='40%'>\n";
@@ -117,7 +117,7 @@
//send the event socket command and get the response
//callcenter_config queue list tiers [queue_name] |
$switch_command = 'callcenter_config queue list tiers '.$queue_extension."@".$_SESSION["domain_name"];
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
$event_socket_str = trim(event_socket::api($switch_command));
$result = str_to_named_array($event_socket_str, '|');
//prepare the result for array_multisort
@@ -139,7 +139,7 @@
//send the event socket command and get the response
//callcenter_config queue list agents [queue_name] [status] |
$switch_command = 'callcenter_config queue list agents '.$queue_extension."@".$_SESSION["domain_name"];
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
$event_socket_str = trim(event_socket::api($switch_command));
$agent_result = str_to_named_array($event_socket_str, '|');
//get the agents from the database
@@ -280,7 +280,7 @@
//callcenter_config queue list members [queue_name]
if (is_uuid($queue_uuid)) {
$switch_command = 'callcenter_config queue list members '.$queue_extension."@".$_SESSION["domain_name"];
$event_socket_str = trim(event_socket_request($fp, 'api '.$switch_command));
$event_socket_str = trim(event_socket::api($switch_command));
$result = str_to_named_array($event_socket_str, '|');
if (!is_array($result)) { unset($result); }
}