diff --git a/RestControllers/CallsController.php b/RestControllers/CallsController.php index 9825bd5..c5b8f95 100644 --- a/RestControllers/CallsController.php +++ b/RestControllers/CallsController.php @@ -86,6 +86,9 @@ class CallsController { if(!$call->isValid()) Rest_fatal_error(500, "Could not get information about the call!"); + //Update last activity of the call + components()->calls->updateLastActivity($call_id); + return self::CallInformationToAPI($call); } diff --git a/classes/components/CallsComponent.php b/classes/components/CallsComponent.php index 7e50800..c83f109 100644 --- a/classes/components/CallsComponent.php +++ b/classes/components/CallsComponent.php @@ -99,6 +99,27 @@ class CallsComponents { return $info; } + /** + * Update last activity time of a conversation + * + * @param $call_id The ID of the call to update + * @return bool TRUE for a success / FALSE else + */ + public function updateLastActivity(int $call_id) : bool { + + return db()->updateDB( + self::CALLS_LIST_TABLE, + "id = ?", + array( + "last_active" => time() + ), + array( + $call_id + ) + ); + + } + /** * Get the next call for a user *