Add callback for phone calls, not tested yet

This commit is contained in:
osaajani 2021-03-23 17:39:13 +01:00
parent 52a0302dc2
commit 41c3b3b86e
13 changed files with 378 additions and 57 deletions

View file

@ -146,6 +146,16 @@ namespace adapters;
{
return true;
}
public static function meta_support_inbound_call_callback(): bool
{
return false;
}
public static function meta_support_end_call_callback(): bool
{
return false;
}
public function send(string $destination, string $text, bool $flash = false, bool $mms = false, array $medias = []) : array
{
@ -272,4 +282,58 @@ namespace adapters;
{
return [];
}
public function inbound_call_callback(): array
{
$response = [
'error' => false,
'error_message' => null,
'call' => [],
];
$uid = $_POST['uid'] ?? false;
$start = $_POST['start'] ?? false;
$end = $_POST['end'] ?? null;
$origin = $_POST['origin'] ?? false;
if (!$uid || !$start || !$origin)
{
$response['error'] = true;
$response['error_message'] = 'Missing required argument.';
return $response;
}
$response['call']['uid'] = $uid;
$response['call']['start'] = $start;
$response['call']['end'] = $end;
$response['call']['origin'] = $origin;
return $response;
}
public function end_call_callback(): array
{
$response = [
'error' => false,
'error_message' => null,
'call' => [],
];
$uid = $_POST['uid'] ?? false;
$end = $_POST['end'] ?? null;
if (!$uid || !$end)
{
$response['error'] = true;
$response['error_message'] = 'Missing required argument.';
return $response;
}
$response['call']['uid'] = $uid;
$response['call']['end'] = $end;
return $response;
}
}