1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* MikoPBX - free phone system for small business |
4
|
|
|
* Copyright © 2017-2023 Alexey Portnov and Nikolay Beketov |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License along with this program. |
17
|
|
|
* If not, see <https://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace MikoPBX\PBXCoreREST\Controllers\Extensions; |
21
|
|
|
|
22
|
|
|
use MikoPBX\PBXCoreREST\Controllers\BaseController; |
23
|
|
|
use MikoPBX\PBXCoreREST\Lib\ExtensionsManagementProcessor; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Handles the GET request for extensions data. |
27
|
|
|
* |
28
|
|
|
* @RoutePrefix("/pbxcore/api/extensions") |
29
|
|
|
* |
30
|
|
|
* @examples |
31
|
|
|
* curl http://127.0.0.1/pbxcore/api/extensions/getForSelect?type=all; |
32
|
|
|
* curl http://127.0.0.1/pbxcore/api/extensions/available?number=225; |
33
|
|
|
* curl http://127.0.0.1/pbxcore/api/extensions/getPhoneRepresent?number=225; |
34
|
|
|
* curl http://127.0.0.1/pbxcore/api/extensions/getRecord?id=195 |
35
|
|
|
*/ |
36
|
|
|
class GetController extends BaseController |
37
|
|
|
{ |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Calls the corresponding action for IAX registrations based on the provided $actionName. |
41
|
|
|
* |
42
|
|
|
* @param string $actionName The name of the action. |
43
|
|
|
* |
44
|
|
|
* Retrieves the extension data structure, if id will not find it returns empty structure |
45
|
|
|
* @Get("/getRecord") |
46
|
|
|
* |
47
|
|
|
* Retrieves the extensions list limited by type parameter. |
48
|
|
|
* @Get("/getForSelect") |
49
|
|
|
* |
50
|
|
|
* Checks the number uniqueness. |
51
|
|
|
* @Get("/available") |
52
|
|
|
* |
53
|
|
|
* Returns CallerID names for the number. |
54
|
|
|
* @Get("/getPhoneRepresent") |
55
|
|
|
* |
56
|
|
|
* @return void |
57
|
|
|
*/ |
58
|
|
|
public function callAction(string $actionName): void |
59
|
|
|
{ |
60
|
|
|
$requestData = $this->request->get(); |
61
|
|
|
$this->sendRequestToBackendWorker(ExtensionsManagementProcessor::class, $actionName, $requestData); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
} |