mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2025-12-30 00:53:50 +00:00
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:
@@ -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); }
|
||||
}
|
||||
|
||||
@@ -90,8 +90,7 @@
|
||||
|
||||
//run the command
|
||||
if (isset($switch_command)) {
|
||||
$fp = event_socket_create();
|
||||
$response = event_socket_request($fp, 'api '.$switch_command);
|
||||
$response = event_socket::api($switch_command);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -134,14 +133,14 @@
|
||||
//fs cmd
|
||||
if (!empty($switch_cmd)) {
|
||||
//setup the event socket connection
|
||||
$fp = event_socket_create();
|
||||
$esl = event_socket::create();
|
||||
//ensure the connection exists
|
||||
if ($fp) {
|
||||
if ($esl) {
|
||||
//send the command
|
||||
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
|
||||
$switch_result = event_socket::api($switch_cmd);
|
||||
//set the user state
|
||||
$cmd = "api callcenter_config agent set state ".$username."@".$_SESSION['domain_name']." Waiting";
|
||||
$response = event_socket_request($fp, $cmd);
|
||||
$response = event_socket::command($cmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user