Commit a2c99ff6 authored by okhin's avatar okhin 🚴

Populating the feedback SIP function and mapping it

parent 54a04408
Pipeline #737 failed with stage
......@@ -55,9 +55,25 @@ class Main extends Controller {
/*
* Feedback SIP function
* Get a feedback from the SIP system - status of a call for instance
* GET: get the call back
*/
function feedbacksip($f3, $args) {
//GET
$token = JWT::encode(array('api' => JWT_TOKEN), JWT_KEY);
$call_id = $args['callid'];
// Create the call
$data = array('api' => 'piphone', 'token' => $token);
$client = new GuzzleHttp\Client(['base_uri' => SIP_API]);
try {
$res = $client->get("calls/$call_id", ['query' => $data]);
return ($res->getBody());
} catch (RequestException $e) {
echo Psr7\str($e->getRequest());
if ($e->hasResponse()) {
echo Psr7\str($e->getResponse());
}
}
}
/*
......
......@@ -4,7 +4,7 @@ GET @home:/=Main->home
GET|POST @feedback:/feedback=Main->feedbackform
GET|POST @call:/call/@id=Main->call
GET @contactslist:/contactslist=Main->contactslist
POST @feedbacksip:/feedbacksip=Main->feedbacksip
GET @feedbacksip:/feedbacksip/@callid=Main->feedbacksip
GET @argumentation:/argumentation=Main->argumentation
; Fake REST API
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment