Fix active calls eavesdrop (#7419)
* Remove old debug comments * Remove unused variable * Remove debug information * Fix eavesdrop missing domain_name * Remove extended debug information
This commit is contained in:
@@ -556,15 +556,15 @@ class active_calls_service extends service implements websocket_service_interfac
|
|||||||
$response['topic'] = $websocket_message->topic;
|
$response['topic'] = $websocket_message->topic;
|
||||||
$response['request_id'] = $websocket_message->request_id;
|
$response['request_id'] = $websocket_message->request_id;
|
||||||
|
|
||||||
// Get the payload
|
// Get the payload and domain from message
|
||||||
$payload = $websocket_message->payload();
|
$payload = $websocket_message->payload();
|
||||||
|
$domain_name = $websocket_message->domain_name() ?? '';
|
||||||
|
|
||||||
// Get the eavesdrop information from the payload to send to the switch
|
// Get the eavesdrop information from the payload to send to the switch
|
||||||
$uuid = $payload['unique_id'] ?? '';
|
$uuid = $payload['unique_id'] ?? '';
|
||||||
$origination_caller_id_name = $payload['origination_caller_id_name'] ?? '';
|
$origination_caller_id_name = $payload['origination_caller_id_name'] ?? '';
|
||||||
$caller_caller_id_number = $payload['caller_caller_id_number'] ?? '';
|
$caller_caller_id_number = $payload['caller_caller_id_number'] ?? '';
|
||||||
$origination_caller_contact = $payload['origination_caller_contact'] ?? '';
|
$origination_caller_contact = $payload['origination_caller_contact'] ?? '';
|
||||||
$domain_name = $payload['domain_name'] ?? '';
|
|
||||||
|
|
||||||
$response['status_message'] = 'success';
|
$response['status_message'] = 'success';
|
||||||
$response['status_code'] = 200;
|
$response['status_code'] = 200;
|
||||||
@@ -815,7 +815,7 @@ class active_calls_service extends service implements websocket_service_interfac
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug("Received message on websocket: $json_string (" . strlen($json_string) . " bytes)");
|
$this->debug("Received message on websocket: (" . strlen($json_string) . " bytes)");
|
||||||
|
|
||||||
// Get the web socket message as an object
|
// Get the web socket message as an object
|
||||||
$message = websocket_message::create_from_json_message($json_string);
|
$message = websocket_message::create_from_json_message($json_string);
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ class subscriber {
|
|||||||
|
|
||||||
// Check for required fields
|
// Check for required fields
|
||||||
if (empty($request_token)) {
|
if (empty($request_token)) {
|
||||||
$date = date('Y/m/d H:i:s', time());
|
//$date = date('Y/m/d H:i:s', time());
|
||||||
//self::$logger->warn("Empty token given for $this->id");
|
//self::$logger->warn("Empty token given for $this->id");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -500,19 +500,6 @@ class subscriber {
|
|||||||
$valid = $valid && (time() - $token_time < $token_limit * 60); // token_time_limit * 60 seconds = 15 minutes
|
$valid = $valid && (time() - $token_time < $token_limit * 60); // token_time_limit * 60 seconds = 15 minutes
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug information
|
|
||||||
if (true) {
|
|
||||||
//self::$logger->debug("------------------ Authenticate Token Compare ------------------");
|
|
||||||
//self::$logger->debug(" Subscriber token name: ".$request_token['name']);
|
|
||||||
//self::$logger->debug(" Subscriber token hash: ".$request_token['hash']);
|
|
||||||
//self::$logger->debug(" Server token name: $token_name");
|
|
||||||
//self::$logger->debug(" Server token hash: $token_hash");
|
|
||||||
//self::$logger->debug(" Server token time: $token_time");
|
|
||||||
//self::$logger->debug(" Server token limit: $token_limit");
|
|
||||||
//self::$logger->debug("Valid: " . ($valid ? 'yes' : 'no'));
|
|
||||||
//self::$logger->debug("----------------------------------------------------------------");
|
|
||||||
}
|
|
||||||
|
|
||||||
// When token is valid
|
// When token is valid
|
||||||
if ($valid) {
|
if ($valid) {
|
||||||
|
|
||||||
@@ -855,16 +842,10 @@ class subscriber {
|
|||||||
* @return bool True if the token has expired. False if the token is still valid
|
* @return bool True if the token has expired. False if the token is still valid
|
||||||
*/
|
*/
|
||||||
public function token_time_exceeded(): bool {
|
public function token_time_exceeded(): bool {
|
||||||
if (!$this->enable_token_time_limit)
|
if (!$this->enable_token_time_limit) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//self::$logger->debug("------------- TOKEN TIME LIMIT -------------");
|
|
||||||
//self::$logger->debug(" Token Limit: $this->token_limit");
|
|
||||||
//self::$logger->debug(" Token Time: $this->token_time");
|
|
||||||
//self::$logger->debug(" Current Time: " . time());
|
|
||||||
//self::$logger->debug("time-token_time: " . (time() - $this->token_time));
|
|
||||||
//self::$logger->debug(" Time Exceeded: " . ((time() - $this->token_time) > $this->token_limit ? 'Yes' : 'No'));
|
|
||||||
//self::$logger->debug("--------------------------------------------");
|
|
||||||
//test the time on the token to ensure it is valid
|
//test the time on the token to ensure it is valid
|
||||||
return (time() - $this->token_time) > $this->token_limit;
|
return (time() - $this->token_time) > $this->token_limit;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -711,19 +711,19 @@ class websocket_service extends service {
|
|||||||
@fclose($resource);
|
@fclose($resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->debug("OLD Client List: " . var_dump($this->clients, true));
|
//$this->debug("OLD Client List: " . var_dump($this->clients, true));
|
||||||
|
|
||||||
// Clean out the array
|
// Clean out the array
|
||||||
$clients = array_filter($this->clients, function ($resource) {
|
$clients = array_filter($this->clients, function ($resource) {
|
||||||
return is_resource($resource) && !feof($resource);
|
return is_resource($resource) && !feof($resource);
|
||||||
});
|
});
|
||||||
|
|
||||||
$this->debug("NEW Client List: " . var_dump($clients, true));
|
//$this->debug("NEW Client List: " . var_dump($clients, true));
|
||||||
|
|
||||||
// Compare to the original array
|
// Compare to the original array
|
||||||
$diff = array_diff($this->clients, $clients);
|
$diff = array_diff($this->clients, $clients);
|
||||||
|
|
||||||
$this->debug("DIFF Client List: " . var_dump($diff, true));
|
//$this->debug("DIFF Client List: " . var_dump($diff, true));
|
||||||
|
|
||||||
// Replace the old list with only the connected ones
|
// Replace the old list with only the connected ones
|
||||||
$this->clients = $clients;
|
$this->clients = $clients;
|
||||||
|
|||||||
Reference in New Issue
Block a user