Automatically update last activity time of a call

This commit is contained in:
Pierre HUBERT 2019-01-25 14:25:06 +01:00
parent 10b50d4664
commit b94c859a16
2 changed files with 24 additions and 0 deletions

View File

@ -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);
}

View File

@ -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
*