Fix FLEXIAPI-146 Add devices management panels for accounts

This commit is contained in:
Timothée Jaussoin 2024-03-05 16:53:00 +01:00
parent 9e2fcf2c3d
commit 8780050487
8 changed files with 317 additions and 97 deletions

View file

@ -43,7 +43,7 @@ class AuthTokenController extends Controller
->data(
$authToken->account_id
? route('auth_tokens.auth', ['token' => $authToken->token])
: route('auth_tokens.auth.external', ['token' => $authToken->token])
: route('account.auth_tokens.auth.external', ['token' => $authToken->token])
)
->encoding(new Encoding('UTF-8'))
->errorCorrectionLevel(new ErrorCorrectionLevelHigh())

View file

@ -0,0 +1,62 @@
<?php
/*
Flexisip Account Manager is a set of tools to manage SIP accounts.
Copyright (C) 2020 Belledonne Communications SARL, All rights reserved.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Libraries\FlexisipConnector;
class DeviceController extends Controller
{
public function index(Request $request)
{
$connector = new FlexisipConnector;
return view(
'account.device.index',
[
'account' => $request->user(),
'devices' => $connector->getDevices($request->user()->identifier)
]
);
}
public function delete(Request $request, string $uuid)
{
$connector = new FlexisipConnector;
return view(
'account.device.delete',
[
'account' => $request->user(),
'devices' => $connector->getDevices($request->user()->identifier)
->where('uuid', $uuid)->first()
]
);
}
public function destroy(Request $request)
{
$connector = new FlexisipConnector;
$connector->deleteDevice($request->user()->identifier, $request->get('uuid'));
return redirect()->route('account.device.index');
}
}

View file

@ -555,6 +555,10 @@ h3+p {
margin-top: 1rem;
}
h3+p:has(span.badge) {
margin-top: 0;
}
.line {
overflow: hidden;
text-overflow: ellipsis;

View file

@ -26,6 +26,12 @@
@endif
<a href="{{ route('account.phone.change') }}">Change my current account phone</a>
</p>
<p>
<i class="material-symbols-outlined">devices</i>
<a href="{{ route('account.device.index') }}">
Edit my devices
</a>
</p>
<p>
<i class="material-symbols-outlined">lock</i>
<a href="{{ route('account.password.show') }}">

View file

@ -0,0 +1,28 @@
@extends('layouts.main')
@section('breadcrumb')
<li class="breadcrumb-item">
<a href="{{ route('account.device.index') }}">Devices</a>
</li>
<li class="breadcrumb-item active" aria-current="page">Delete</li>
@endsection
@section('content')
<h2>Device deletion</h2>
<div>
<p>Are you sure you want to delete the following device?</p>
<p>
<b>User Agent:</b> {{ $device->user_agent }}
</p>
</div>
<form method="POST" action="{{ route('account.device.destroy') }}" accept-charset="UTF-8">
@method('delete')
@csrf
<input name="uuid" type="hidden" value="{{ $device->uuid }}">
<div>
<input class="btn" type="submit" value="Delete">
</div>
</form>
@endsection

View file

@ -0,0 +1,41 @@
@extends('layouts.main')
@section('breadcrumb')
<li class="breadcrumb-item active" aria-current="page">Devices</li>
@endsection
@section('content')
<header>
<h1><i class="material-symbols-outlined">devices</i> Devices management</h1>
</header>
<table>
<thead>
<tr>
<th>User Agent</th>
<th></th>
</tr>
</thead>
<tbody>
@if ($devices->isEmpty())
<tr class="empty">
<td colspan="3">No Devices</td>
</tr>
@endif
@foreach ($devices as $device)
<tr>
<td>{{ $device->user_agent }}</td>
<td>
<a type="button"
class="btn"
href="{{ route('account.device.delete', [$device->uuid]) }}">
Delete
</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endsection

View file

@ -72,7 +72,8 @@ You can find more documentation on the related [IETF RFC-7616](https://tools.iet
## Ping
### `GET /ping` <span class="badge badge-success">Public</span>
### `GET /ping`
<span class="badge badge-success">Public</span>
Returns `pong`
@ -80,7 +81,8 @@ Returns `pong`
An `account_creation_request_token` is a unique token that can be validated and then used to generate a valid `account_creation_token`.
### `POST /account_creation_request_tokens` <span class="badge badge-success">Public</span>
### `POST /account_creation_request_tokens`
<span class="badge badge-success">Public</span>
Create and return an `account_creation_request_token` that should then be validated to be used.
@ -88,7 +90,8 @@ Create and return an `account_creation_request_token` that should then be valida
An `account_creation_token` is a unique token that allow the creation of a **unique** account.
### `POST /account_creation_tokens/send-by-push` <span class="badge badge-success">Public</span>
### `POST /account_creation_tokens/send-by-push`
<span class="badge badge-success">Public</span>
Create and send an `account_creation_token` using a push notification to the device.
Return `403` if a token was already sent, or if the tokens limit is reached for this device.
@ -100,7 +103,8 @@ JSON parameters:
* `pn_param` the push notification parameter
* `pn_prid` the push notification unique id
### `POST /account_creation_tokens/using-account-creation-request-token` <span class="badge badge-success">Public</span>
### `POST /account_creation_tokens/using-account-creation-request-token`
<span class="badge badge-success">Public</span>
Create an `account_creation_token` using an `account_creation_request_token`.
Return an `account_creation_token`.
@ -110,19 +114,22 @@ JSON parameters:
* `account_creation_request_token` required
### `POST /account_creation_tokens` <span class="badge badge-warning">Admin</span>
### `POST /account_creation_tokens`
<span class="badge badge-warning">Admin</span>
Create and return an `account_creation_token`.
## Auth Tokens
### `POST /accounts/auth_token` <span class="badge badge-success">Public</span>
### `POST /accounts/auth_token`
<span class="badge badge-success">Public</span>
Generate an `auth_token`. To attach the generated token to an account see [`auth_token` attachement endpoint](#get-accountsauthtokenauthtokenattach).
Return the `auth_token` object.
### `GET /accounts/auth_token/{auth_token}/attach` <span class="badge badge-info">User</span>
### `GET /accounts/auth_token/{auth_token}/attach`
<span class="badge badge-info">User</span>
Attach a publicly generated authentication token to the currently authenticated account.
@ -130,7 +137,8 @@ Return `404` if the token is non existing or invalid.
## Accounts
### `POST /accounts/public` <span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
### `POST /accounts/public`
<span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
Create an account.
Return `422` if the parameters are invalid.
@ -146,7 +154,8 @@ JSON parameters:
* `phone` required if `username` not set, optional if `email` set, a phone number, set a phone number to the account
* `account_creation_token` the unique `account_creation_token`
### `POST /accounts/with-account-creation-token` <span class="badge badge-success">Public</span>
### `POST /accounts/with-account-creation-token`
<span class="badge badge-success">Public</span>
Create an account using an `account_creation_token`.
Return `422` if the parameters are invalid or if the token is expired.
@ -159,19 +168,22 @@ JSON parameters:
* `account_creation_token` the unique `account_creation_token`
* `dtmf_protocol` optional, values must be `sipinfo`, `sipmessage` or `rfc2833`
### `GET /accounts/{sip}/info` <span class="badge badge-success">Public</span>
### `GET /accounts/{sip}/info`
<span class="badge badge-success">Public</span>
Retrieve public information about the account.
Return `404` if the account doesn't exists.
### `GET /accounts/{phone}/info-by-phone` <span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
### `GET /accounts/{phone}/info-by-phone`
<span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
Retrieve public information about the account.
Return `404` if the account doesn't exists.
Return `phone: true` if the returned account has a phone number.
### `POST /accounts/recover-by-phone` <span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
### `POST /accounts/recover-by-phone`
<span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
Send a SMS with a recovery PIN code to the `phone` number provided.
Return `404` if the account doesn't exists.
@ -183,7 +195,8 @@ JSON parameters:
* `phone` required the phone number to send the SMS to
* `account_creation_token` the unique `account_creation_token`
### `GET /accounts/{sip}/recover/{recover_key}` <span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
### `GET /accounts/{sip}/recover/{recover_key}`
<span class="badge badge-message">Deprecated</span> @if(!config('app.dangerous_endpoints'))<span class="badge">Disabled</span>@endif <span class="badge badge-success">Public</span> <span class="badge badge-error">Unsecure endpoint</span>
Activate the account if the correct `recover_key` is provided.
@ -193,7 +206,8 @@ Return the account information (including the hashed password) if valid.
Return `404` if the account doesn't exists.
### `POST /accounts/{sip}/activate/email` <span class="badge badge-message">Deprecated</span> <span class="badge badge-success">Public</span>
### `POST /accounts/{sip}/activate/email`
<span class="badge badge-message">Deprecated</span> <span class="badge badge-success">Public</span>
<a href="#post-accountsmeemailrequest">Use `POST /accounts/me/email/request` instead</a>.
@ -204,7 +218,8 @@ JSON parameters:
* `confirmation_key` the confirmation key
### `POST /accounts/{sip}/activate/phone` <span class="badge badge-message">Deprecated</span> <span class="badge badge-success">Public</span>
### `POST /accounts/{sip}/activate/phone`
<span class="badge badge-message">Deprecated</span> <span class="badge badge-success">Public</span>
<a href="#post-accountsmephonerequest">Use `POST /accounts/me/phone/request` instead</a>.
@ -215,7 +230,8 @@ JSON parameters:
* `confirmation_key` the PIN code
### `GET /accounts/me/api_key/{auth_token}` <span class="badge badge-success">Public</span>
### `GET /accounts/me/api_key/{auth_token}`
<span class="badge badge-success">Public</span>
Generate and retrieve a fresh API Key from an `auth_token`. The `auth_token` must be attached to an existing account, see [`auth_token` attachement endpoint](#get-accountsauthtokenauthtokenattach) to do so.
@ -223,26 +239,31 @@ Return `404` if the token is invalid or not attached.
This endpoint is also setting the API Key as a Cookie.
### `GET /accounts/me/api_key` <span class="badge badge-info">User</span>
### `GET /accounts/me/api_key`
<span class="badge badge-info">User</span>
Generate and retrieve a fresh API Key.
This endpoint is also setting the API Key as a Cookie.
### `GET /accounts/me` <span class="badge badge-info">User</span>
### `GET /accounts/me`
<span class="badge badge-info">User</span>
Retrieve the account information.
### `GET /accounts/me/provision` <span class="badge badge-info">User</span>
### `GET /accounts/me/provision`
<span class="badge badge-info">User</span>
Provision the account by generating a fresh `provisioning_token`.
Return the account object.
### `DELETE /accounts/me` <span class="badge badge-info">User</span>
### `DELETE /accounts/me`
<span class="badge badge-info">User</span>
Delete the account.
### `POST /accounts/me/password` <span class="badge badge-info">User</span>
### `POST /accounts/me/password`
<span class="badge badge-info">User</span>
Change the account password.
@ -252,7 +273,8 @@ JSON parameters:
* `old_password` required if the password is already set, the old password
* `password` required, the new password
### `POST /accounts` <span class="badge badge-warning">Admin</span>
### `POST /accounts`
<span class="badge badge-warning">Admin</span>
To create an account directly from the API. <span class="badge badge-message">Deprecated</span> If `activated` is set to `false` a random generated `confirmation_key` and `provisioning_token` will be returned to allow further activation using the public endpoints and provision the account. Check `confirmation_key_expires` to also set an expiration date on that `confirmation_key`.
@ -271,7 +293,8 @@ JSON parameters:
* `dictionary` optional, an associative array attached to the account, <a href="#dictionary">see also the related endpoints</a>.
* <span class="badge badge-message">Deprecated</span> `confirmation_key_expires` optional, a datetime of this format: Y-m-d H:i:s. Only used when `activated` is not used or `false`. Enforces an expiration date on the returned `confirmation_key`. After that datetime public email or phone activation endpoints will return `403`.
### `PUT /accounts/{id}` <span class="badge badge-warning">Admin</span>
### `PUT /accounts/{id}`
<span class="badge badge-warning">Admin</span>
Update an existing account.
@ -286,49 +309,60 @@ JSON parameters:
* `phone` optional, a phone number, set a phone number to the account
* `dtmf_protocol` optional, values must be `sipinfo`, `sipmessage` or `rfc2833`
### `GET /accounts` <span class="badge badge-warning">Admin</span>
### `GET /accounts`
<span class="badge badge-warning">Admin</span>
Retrieve all the accounts, paginated.
### `GET /accounts/{id}` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}`
<span class="badge badge-warning">Admin</span>
Retrieve a specific account.
### `GET /accounts/{sip}/search` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{sip}/search`
<span class="badge badge-warning">Admin</span>
Search for a specific account by sip address.
### `GET /accounts/{email}/search-by-email` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{email}/search-by-email`
<span class="badge badge-warning">Admin</span>
Search for a specific account by email.
### `DELETE /accounts/{id}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}`
<span class="badge badge-warning">Admin</span>
Delete a specific account and its related information.
### `POST /accounts/{id}/activate` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/activate`
<span class="badge badge-warning">Admin</span>
Activate an account.
### `POST /accounts/{id}/deactivate` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/deactivate`
<span class="badge badge-warning">Admin</span>
Deactivate an account.
### `POST /accounts/{id}/block` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/block`
<span class="badge badge-warning">Admin</span>
Block an account.
### `POST /accounts/{id}/unblock` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/unblock`
<span class="badge badge-warning">Admin</span>
Unblock an account.
### `GET /accounts/{id}/provision` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}/provision`
<span class="badge badge-warning">Admin</span>
Provision an account by generating a fresh `provisioning_token`.
## Accounts email
### `POST /accounts/me/email/request` <span class="badge badge-info">User</span>
### `POST /accounts/me/email/request`
<span class="badge badge-info">User</span>
Change the account email. An email will be sent to the new email address to confirm the operation.
@ -338,7 +372,8 @@ JSON parameters:
## Accounts phone number
### `POST /accounts/me/phone/request` <span class="badge badge-info">User</span>
### `POST /accounts/me/phone/request`
<span class="badge badge-info">User</span>
Request a specific code by SMS
@ -346,7 +381,8 @@ JSON parameters:
* `phone` the phone number to send the SMS
### `POST /accounts/me/phone` <span class="badge badge-info">User</span>
### `POST /accounts/me/phone`
<span class="badge badge-info">User</span>
Confirm the code received and change the phone number.
Activate the account.
@ -359,45 +395,54 @@ Return the updated account.
## Accounts devices
### `GET /accounts/me/devices` <span class="badge badge-info">User</span>
### `GET /accounts/me/devices`
<span class="badge badge-info">User</span>
Return the user registered devices.
### `DELETE /accounts/me/devices/{uuid}` <span class="badge badge-info">User</span>
### `DELETE /accounts/me/devices/{uuid}`
<span class="badge badge-info">User</span>
Remove one of the user registered devices.
## Account contacts
### `GET /accounts/me/contacts` <span class="badge badge-info">User</span>
### `GET /accounts/me/contacts`
<span class="badge badge-info">User</span>
Return the user contacts.
### `GET /accounts/me/contacts/{sip}` <span class="badge badge-info">User</span>
### `GET /accounts/me/contacts/{sip}`
<span class="badge badge-info">User</span>
Return a user contact.
## Contacts
### `GET /accounts/{id}/contacts` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}/contacts`
<span class="badge badge-warning">Admin</span>
Get all the account contacts.
### `POST /accounts/{id}/contacts/{contact_id}` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/contacts/{contact_id}`
<span class="badge badge-warning">Admin</span>
Add a contact to the list.
### `DELETE /accounts/{id}/contacts/{contact_id}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}/contacts/{contact_id}`
<span class="badge badge-warning">Admin</span>
Remove a contact from the list.
## Dictionary
### `GET /accounts/{id}/dictionary` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}/dictionary`
<span class="badge badge-warning">Admin</span>
Get all the account dictionary entries.
### `POST /accounts/{id}/dictionary/{key}` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/dictionary/{key}`
<span class="badge badge-warning">Admin</span>
Add or update a new entry to the dictionary
@ -405,7 +450,8 @@ JSON parameters:
* `value` required, the entry value
### `DELETE /accounts/{id}/dictionary/{key}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}/dictionary/{key}`
<span class="badge badge-warning">Admin</span>
Remove an entry from the dictionary.
@ -413,15 +459,18 @@ Remove an entry from the dictionary.
The following endpoints will return `403 Forbidden` if the requested account doesn't have a DTMF protocol configured.
### `GET /accounts/{id}/actions` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}/actions`
<span class="badge badge-warning">Admin</span>
Show an account related actions.
### `GET /accounts/{id}/actions/{action_id}` <span class="badge badge-warning">Admin</span>
### `GET /accounts/{id}/actions/{action_id}`
<span class="badge badge-warning">Admin</span>
Show an account related action.
### `POST /accounts/{id}/actions/` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/actions/`
<span class="badge badge-warning">Admin</span>
Create an account action.
@ -430,7 +479,8 @@ JSON parameters:
* `key` required, alpha numeric with dashes, lowercase
* `code` required, alpha numeric, lowercase
### `PUT /accounts/{id}/actions/{action_id}` <span class="badge badge-warning">Admin</span>
### `PUT /accounts/{id}/actions/{action_id}`
<span class="badge badge-warning">Admin</span>
Create an account action.
@ -439,21 +489,25 @@ JSON parameters:
* `key` required, alpha numeric with dashes, lowercase
* `code` required, alpha numeric, lowercase
### `DELETE /accounts/{id}/actions/{action_id}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}/actions/{action_id}`
<span class="badge badge-warning">Admin</span>
Delete an account related action.
## Contacts Lists
### `GET /contacts_lists` <span class="badge badge-warning">Admin</span>
### `GET /contacts_lists`
<span class="badge badge-warning">Admin</span>
Show all the contacts lists.
### `GET /contacts_lists/{id}` <span class="badge badge-warning">Admin</span>
### `GET /contacts_lists/{id}`
<span class="badge badge-warning">Admin</span>
Show a contacts list.
### `POST /contacts_lists` <span class="badge badge-warning">Admin</span>
### `POST /contacts_lists`
<span class="badge badge-warning">Admin</span>
Create a contacts list.
@ -462,7 +516,8 @@ JSON parameters:
* `title` required
* `description` required
### `PUT /contacts_lists/{id}` <span class="badge badge-warning">Admin</span>
### `PUT /contacts_lists/{id}`
<span class="badge badge-warning">Admin</span>
Update a contacts list.
@ -471,37 +526,45 @@ JSON parameters:
* `title` required
* `description` required
### `DELETE /contacts_lists/{id}` <span class="badge badge-warning">Admin</span>
### `DELETE /contacts_lists/{id}`
<span class="badge badge-warning">Admin</span>
Delete a contacts list.
### `POST /contacts_lists/{contacts_list_id}/contacts/{contact_id}` <span class="badge badge-warning">Admin</span>
### `POST /contacts_lists/{contacts_list_id}/contacts/{contact_id}`
<span class="badge badge-warning">Admin</span>
Add a contact to the contacts list.
### `DELETE /contacts_lists/{contacts_list_id}/contacts/{contact_id}` <span class="badge badge-warning">Admin</span>
### `DELETE /contacts_lists/{contacts_list_id}/contacts/{contact_id}`
<span class="badge badge-warning">Admin</span>
Remove a contact from the contacts list.
### `POST /accounts/{id}/contacts_lists/{contacts_list_id}` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/contacts_lists/{contacts_list_id}`
<span class="badge badge-warning">Admin</span>
Add a contacts list to the account.
### `DELETE /accounts/{id}/contacts_lists/{contacts_list_id}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}/contacts_lists/{contacts_list_id}`
<span class="badge badge-warning">Admin</span>
Remove a contacts list from the account.
## Account Types
### `GET /account_types` <span class="badge badge-warning">Admin</span>
### `GET /account_types`
<span class="badge badge-warning">Admin</span>
Show all the account types.
### `GET /account_types/{id}` <span class="badge badge-warning">Admin</span>
### `GET /account_types/{id}`
<span class="badge badge-warning">Admin</span>
Show an account type.
### `POST /account_types` <span class="badge badge-warning">Admin</span>
### `POST /account_types`
<span class="badge badge-warning">Admin</span>
Create an account type.
@ -509,7 +572,8 @@ JSON parameters:
* `key` required, alpha numeric with dashes, lowercase
### `PUT /account_types/{id}` <span class="badge badge-warning">Admin</span>
### `PUT /account_types/{id}`
<span class="badge badge-warning">Admin</span>
Update an account type.
@ -517,21 +581,25 @@ JSON parameters:
* `key` required, alpha numeric with dashes, lowercase
### `DELETE /account_types/{id}` <span class="badge badge-warning">Admin</span>
### `DELETE /account_types/{id}`
<span class="badge badge-warning">Admin</span>
Delete an account type.
### `POST /accounts/{id}/types/{type_id}` <span class="badge badge-warning">Admin</span>
### `POST /accounts/{id}/types/{type_id}`
<span class="badge badge-warning">Admin</span>
Add a type to the account.
### `DELETE /accounts/{id}/contacts/{type_id}` <span class="badge badge-warning">Admin</span>
### `DELETE /accounts/{id}/contacts/{type_id}`
<span class="badge badge-warning">Admin</span>
Remove a type from the account.
## Messages
### `POST /messages` <span class="badge badge-warning">Admin</span>
### `POST /messages`
<span class="badge badge-warning">Admin</span>
Send a message over SIP.
@ -544,7 +612,8 @@ JSON parameters:
FlexiAPI can record logs generated by the FlexiSIP server and compile them into statistics.
### `POST /statistics/messages` <span class="badge badge-warning">Admin</span>
### `POST /statistics/messages`
<span class="badge badge-warning">Admin</span>
Announce the creation of a message.
@ -556,7 +625,8 @@ JSON parameters:
* `encrypted` required, boolean
* `conference_id` string
### `PATCH /statistics/messages/{message_id}/to/{to}/devices/{device_id}` <span class="badge badge-warning">Admin</span>
### `PATCH /statistics/messages/{message_id}/to/{to}/devices/{device_id}`
<span class="badge badge-warning">Admin</span>
Complete a message status.
@ -565,7 +635,8 @@ JSON parameters:
* `last_status` required, an integer containing the last status code
* `received_at` required, format ISO8601, when the message was received
### `POST /statistics/calls` <span class="badge badge-warning">Admin</span>
### `POST /statistics/calls`
<span class="badge badge-warning">Admin</span>
Announce the beginning of a call.
@ -578,7 +649,8 @@ JSON parameters:
* `ended_at` string, format ISO8601, when the call finished
* `conference_id` string
### `PATCH /statistics/calls/{call_id}/devices/{device_id}` <span class="badge badge-warning">Admin</span>
### `PATCH /statistics/calls/{call_id}/devices/{device_id}`
<span class="badge badge-warning">Admin</span>
Complete a call status.
@ -589,7 +661,8 @@ JSON parameters:
* `at` format ISO8601, when the invitation ended
* `state` the termination state
### `PATCH /statistics/calls/{call_id}` <span class="badge badge-warning">Admin</span>
### `PATCH /statistics/calls/{call_id}`
<span class="badge badge-warning">Admin</span>
Update a call when ending.
@ -603,7 +676,8 @@ The following URLs are **not API endpoints** they are not returning `JSON` conte
## Contacts list
### `GET /contacts/vcard` <span class="badge badge-info">User</span>
### `GET /contacts/vcard`
<span class="badge badge-info">User</span>
Return the authenticated user contacts list, in [vCard 4.0 format](https://datatracker.ietf.org/doc/html/rfc6350).
@ -628,6 +702,7 @@ X-LINPHONE-ACCOUNT-DTMF-PROTOCOL:sipinfo
END:VCARD
```
### `GET /contacts/vcard/{sip}` <span class="badge badge-info">User</span>
### `GET /contacts/vcard/{sip}`
<span class="badge badge-info">User</span>
Return a specific user authenticated contact, in [vCard 4.0 format](https://datatracker.ietf.org/doc/html/rfc6350).

View file

@ -20,6 +20,7 @@
use App\Http\Controllers\Account\AccountController;
use App\Http\Controllers\Account\ApiKeyController;
use App\Http\Controllers\Account\CreationRequestTokenController;
use App\Http\Controllers\Account\DeviceController;
use App\Http\Controllers\Account\EmailController;
use App\Http\Controllers\Account\PasswordController;
use App\Http\Controllers\Account\PhoneController;
@ -94,44 +95,47 @@ Route::middleware(['web_panel_enabled'])->group(function () {
Route::get('logout', 'Account\AuthenticateController@logout')->name('account.logout');
});
Route::middleware(['auth', 'auth.check_blocked'])->group(function () {
Route::get('blocked', 'Account\AccountController@blocked')->name('account.blocked');
Route::name('account.')->middleware(['auth', 'auth.check_blocked'])->group(function () {
Route::get('blocked', 'Account\AccountController@blocked')->name('blocked');
// Email change and validation
Route::prefix('email')->controller(EmailController::class)->group(function () {
Route::get('change', 'change')->name('account.email.change');
Route::post('change', 'requestChange')->name('account.email.request_change');
Route::get('validate', 'validateChange')->name('account.email.validate');
Route::post('/', 'store')->name('account.email.update');
Route::get('change', 'change')->name('email.change');
Route::post('change', 'requestChange')->name('email.request_change');
Route::get('validate', 'validateChange')->name('email.validate');
Route::post('/', 'store')->name('email.update');
});
// Phone change and validation
Route::prefix('phone')->controller(PhoneController::class)->group(function () {
Route::get('change', 'change')->name('account.phone.change');
Route::post('change', 'requestChange')->name('account.phone.request_change');
Route::get('validate', 'validateChange')->name('account.phone.validate');
Route::post('/', 'store')->name('account.phone.update');
Route::get('change', 'change')->name('phone.change');
Route::post('change', 'requestChange')->name('phone.request_change');
Route::get('validate', 'validateChange')->name('phone.validate');
Route::post('/', 'store')->name('phone.update');
});
Route::name('device.')->prefix('devices')->controller(DeviceController::class)->group(function () {
Route::get('/', 'index')->name('index');
Route::get('{device_id}/delete', 'delete')->name('delete');
Route::delete('/', 'destroy')->name('destroy');
});
Route::controller(AccountController::class)->group(function () {
Route::get('dashboard', 'panel')->name('account.dashboard');
Route::get('dashboard', 'panel')->name('dashboard');
Route::get('delete', 'delete')->name('account.delete');
Route::delete('delete', 'destroy')->name('account.destroy');
Route::get('delete', 'delete')->name('delete');
Route::delete('delete', 'destroy')->name('destroy');
});
Route::prefix('password')->controller(PasswordController::class)->group(function () {
Route::get('/', 'show')->name('account.password.show');
Route::post('/', 'update')->name('account.password.update');
Route::get('/', 'show')->name('password.show');
Route::post('/', 'update')->name('password.update');
});
Route::prefix('api_key')->controller(ApiKeyController::class)->group(function () {
Route::get('/', 'show')->name('account.api_key.show');
Route::post('/', 'update')->name('account.api_key.update');
Route::get('/', 'show')->name('api_key.show');
Route::post('/', 'update')->name('api_key.update');
});
Route::post('auth_tokens', 'Account\AuthTokenController@create')->name('account.auth_tokens.create');
Route::post('auth_tokens', 'Account\AuthTokenController@create')->name('auth_tokens.create');
Route::get('auth_tokens/auth/external/{token}', 'Account\AuthTokenController@authExternal')->name('auth_tokens.auth.external');
});