mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +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(
|
const USER_RESPONSE_TO_CALL = array(
|
||||||
CallMemberInformation::USER_ACCEPTED => "accepted",
|
CallMemberInformation::USER_ACCEPTED => "accepted",
|
||||||
CallMemberInformation::USER_REJECTED => "rejected",
|
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
|
* @return bool TRUE for a success / FALSE else
|
||||||
*/
|
*/
|
||||||
public function setMemberResponse(int $callID, int $userID, bool $accept) : bool {
|
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(
|
db()->updateDB(
|
||||||
self::CALLS_MEMBERS_TABLE,
|
self::CALLS_MEMBERS_TABLE,
|
||||||
"call_id = ? AND user_id = ?",
|
"call_id = ? AND user_id = ?",
|
||||||
array(
|
array(
|
||||||
"user_accepted" =>
|
"user_accepted" => $status
|
||||||
$accept ? CallMemberInformation::USER_ACCEPTED : CallMemberInformation::USER_REJECTED
|
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
$callID,
|
$callID,
|
||||||
|
@ -13,6 +13,7 @@ class CallMemberInformation extends BaseUniqueObjectFromUser {
|
|||||||
public const USER_ACCEPTED = 1;
|
public const USER_ACCEPTED = 1;
|
||||||
public const USER_REJECTED = 0;
|
public const USER_REJECTED = 0;
|
||||||
public const USER_UNKNOWN = -1;
|
public const USER_UNKNOWN = -1;
|
||||||
|
public const USER_HANG_UP = 2;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user