Update callback to check valid call return
This commit is contained in:
parent
c63f3bebba
commit
86c6d65fe4
|
@ -13,7 +13,8 @@
|
||||||
"twilio/sdk": "^6.1",
|
"twilio/sdk": "^6.1",
|
||||||
"symfony/yaml": "^5.0",
|
"symfony/yaml": "^5.0",
|
||||||
"phpmailer/phpmailer": "^6.1",
|
"phpmailer/phpmailer": "^6.1",
|
||||||
"ralouphie/mimey": "^2.1"
|
"ralouphie/mimey": "^2.1",
|
||||||
|
"kreait/firebase-php": "^5.14"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ use Monolog\Logger;
|
||||||
*/
|
*/
|
||||||
public function inbound_call(int $id_phone)
|
public function inbound_call(int $id_phone)
|
||||||
{
|
{
|
||||||
$this->logger->info('Callback reception call with phone : ' . $id_phone);
|
$this->logger->info('Callback inbound_call call with phone : ' . $id_phone);
|
||||||
$phone = $this->internal_phone->get_for_user($this->user['id'], $id_phone);
|
$phone = $this->internal_phone->get_for_user($this->user['id'], $id_phone);
|
||||||
|
|
||||||
if (!$phone)
|
if (!$phone)
|
||||||
|
@ -291,6 +291,14 @@ use Monolog\Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
$call = $response['call'];
|
$call = $response['call'];
|
||||||
|
|
||||||
|
if (empty($call) || empty($call['uid']) || empty($call['start']) || empty($call['origin']))
|
||||||
|
{
|
||||||
|
$this->logger->error('Callback inbound_call failed : missing required param in call return');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->internal_call->create($this->user['id'], $id_phone, $call['uid'], \models\Call::DIRECTION_INBOUND, $call['start'], $call['end'] ?? null, $call['origin']);
|
$result = $this->internal_call->create($this->user['id'], $id_phone, $call['uid'], \models\Call::DIRECTION_INBOUND, $call['start'], $call['end'] ?? null, $call['origin']);
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
|
@ -349,6 +357,13 @@ use Monolog\Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
$call = $response['call'];
|
$call = $response['call'];
|
||||||
|
if (empty($call) || empty($call['uid']) || empty($call['end']))
|
||||||
|
{
|
||||||
|
$this->logger->error('Callback end call failed : missing required param in call return');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$result = $this->internal_call->end($this->user['id'], $id_phone, $call['uid'], $call['end']);
|
$result = $this->internal_call->end($this->user['id'], $id_phone, $call['uid'], $call['end']);
|
||||||
|
|
||||||
if (!$result)
|
if (!$result)
|
||||||
|
|
Loading…
Reference in New Issue