From f57a57482b20eaf3060bee8eb543c21c71741a96 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 26 Jan 2019 08:01:18 +0100 Subject: [PATCH] Can hang up calls --- RestControllers/CallsController.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/RestControllers/CallsController.php b/RestControllers/CallsController.php index 5ec0764..6eccd49 100644 --- a/RestControllers/CallsController.php +++ b/RestControllers/CallsController.php @@ -133,6 +133,26 @@ class CallsController { ); } + /** + * Hang up a call + * + * @url POST /calls/hangUp + */ + public function hangUp(){ + user_login_required(); + + //Get target call ID + $call_id = $this->GetSafeCallIDFromRequest("call_id"); + + //Make user hang up call + if(!components()->calls->setMemberHangUp($call_id, userID)) + Rest_fatal_error(500, "Could not make user hang up call!"); + + return array( + "success" => "User successfully hang up call!" + ); + } + /** * Get safely the ID of a call from the request *