mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-27 07:49:27 +00:00
Added hang up status
This commit is contained in:
parent
b94c859a16
commit
4d6ada1523
@ -14,7 +14,8 @@ class CallsController {
|
||||
const USER_RESPONSE_TO_CALL = array(
|
||||
CallMemberInformation::USER_ACCEPTED => "accepted",
|
||||
CallMemberInformation::USER_REJECTED => "rejected",
|
||||
CallMemberInformation::USER_UNKNOWN => "unknown"
|
||||
CallMemberInformation::USER_UNKNOWN => "unknown",
|
||||
CallMemberInformation::USER_HANG_UP => "hang_up"
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -265,12 +265,35 @@ class CallsComponents {
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
public function setMemberResponse(int $callID, int $userID, bool $accept) : bool {
|
||||
return $this->setMemberStatus(
|
||||
$accept ? CallMemberInformation::USER_ACCEPTED : CallMemberInformation::USER_REJECTED, $callID, $userID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make user hang up the call
|
||||
*
|
||||
* @param int $callID Target call ID
|
||||
* @param int $userID Target user ID
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
public function setMemberHangUp(int $callID, int $userID) : bool {
|
||||
return $this->setMemberStatus(CallMemberInformation::USER_HANG_UP, $callID, $userID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update member status
|
||||
*
|
||||
* @param $status New status for the user
|
||||
* @param $callID Target call ID
|
||||
* @param $userID Target user ID
|
||||
* @return bool TRUE for a success / FALSE else
|
||||
*/
|
||||
private function setMemberStatus(int $status, int $callID, int $userID){
|
||||
db()->updateDB(
|
||||
self::CALLS_MEMBERS_TABLE,
|
||||
"call_id = ? AND user_id = ?",
|
||||
array(
|
||||
"user_accepted" =>
|
||||
$accept ? CallMemberInformation::USER_ACCEPTED : CallMemberInformation::USER_REJECTED
|
||||
"user_accepted" => $status
|
||||
),
|
||||
array(
|
||||
$callID,
|
||||
|
@ -13,6 +13,7 @@ class CallMemberInformation extends BaseUniqueObjectFromUser {
|
||||
public const USER_ACCEPTED = 1;
|
||||
public const USER_REJECTED = 0;
|
||||
public const USER_UNKNOWN = -1;
|
||||
public const USER_HANG_UP = 2;
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user