mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-20 16:37:48 +02:00
start adding call support
This commit is contained in:
parent
e339dc4758
commit
52a0302dc2
12 changed files with 298 additions and 18 deletions
|
@ -287,11 +287,11 @@ namespace controllers\internals;
|
|||
'origin' => $origin,
|
||||
'command' => $is_command,
|
||||
'mms' => $mms,
|
||||
'medias' => $media_ids,
|
||||
'medias' => $this->get_model()->gets_in_for_user($id_user, $media_ids),
|
||||
];
|
||||
|
||||
$internal_webhook = new Webhook($this->bdd);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE, $received);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_RECEIVE_SMS, $received);
|
||||
|
||||
$internal_user = new User($this->bdd);
|
||||
$internal_user->transfer_received($id_user, $received);
|
||||
|
|
|
@ -236,10 +236,12 @@ namespace controllers\internals;
|
|||
'text' => $text,
|
||||
'destination' => $destination,
|
||||
'origin' => $id_phone,
|
||||
'mms' => $mms,
|
||||
'medias' => $medias,
|
||||
];
|
||||
|
||||
$internal_webhook = new Webhook($this->bdd);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_SEND, $sended);
|
||||
$internal_webhook->trigger($id_user, \models\Webhook::TYPE_SEND_SMS, $sended);
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
|
|
@ -94,17 +94,11 @@ class Webhook extends StandardController
|
|||
*
|
||||
* @param int $id_user : User to trigger the webhook for
|
||||
* @param string $type : Type of webhook to trigger
|
||||
* @param array $sms : The sms [
|
||||
* int 'id' => SMS id,
|
||||
* string 'at' => SMS date,
|
||||
* string 'text' => sms body,
|
||||
* string 'origin' => sms origin (number or phone id)
|
||||
* string 'destination' => sms destination (number or phone id)
|
||||
* ]
|
||||
* @param array $body : The body, an array depending on webhook type
|
||||
*
|
||||
* @return bool : False if no trigger, true else
|
||||
*/
|
||||
public function trigger(int $id_user, string $type, array $sms)
|
||||
public function trigger(int $id_user, string $type, array $body)
|
||||
{
|
||||
$internal_setting = new Setting($this->bdd);
|
||||
$internal_user = new User($this->bdd);
|
||||
|
@ -137,11 +131,7 @@ class Webhook extends StandardController
|
|||
'webhook_type' => $webhook['type'],
|
||||
'webhook_random_id' => $webhook_random_id,
|
||||
'webhook_signature' => $webhook_signature,
|
||||
'id' => $sms['id'],
|
||||
'at' => $sms['at'],
|
||||
'text' => $sms['text'],
|
||||
'origin' => $sms['origin'],
|
||||
'destination' => $sms['destination'],
|
||||
'body' => json_encode($body),
|
||||
],
|
||||
];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue