Refactor controller to HTTP REST API

This commit is contained in:
2023-12-25 18:45:02 +01:00
parent 6d016d272f
commit b820eaff52
2 changed files with 178 additions and 98 deletions

View File

@@ -1,58 +1,46 @@
# FieldPOC controller
The FieldPOC controller is an interactive console to help managing the current state of the FieldPOC system.
The FieldPOC controller is a HTTP REST API to help managing the current state of the FieldPOC system.
Connect to it via the IP address von port set in the [FieldPOC configuration](configuration.md) with `telnet`.
Connect to it via the IP address von port set in the [FieldPOC configuration](configuration.md).
## Commands
## API Endpoints
### Help
### `/sync`
`help`
Show help info.
### Show handlers
`handlers`
Show currently running handlers
### Reconfigure all components
`sync`
```bash
curl --json '{}' http://127.0.0.1:9437/sync
```
Notify all parts of FieldPOC to check configuration of connected components and update it.
### Show queue stats
### `/queues`
`queues`
```bash
curl http://127.0.0.1:9437/queues
```
### Reload configuration
Show internal message queue stats.
`reload`
### `/reload`
Read [FieldPOC configuration](configuration.md) file and apply it.
```bash
curl --json '{}' http://127.0.0.1:9437/reload
```
### Bind extension to DECT device
Read [FieldPOC extensions specification](extensions.md) file and apply it.
`claim <ext> <token>`
### `/claim`
- `ext` is the current extension number of the DECT device.
```bash
curl --json '{"extension": "1111", "token": "1234"}' http://127.0.0.1:9437/claim
```
Bind extension to DECT device
- `extension` is the current extension number of the DECT device.
- `token` is the `dect_claim_token` of the extension that should get applied.
This works because newly connected DECT phones get a temporary number assigned.
This temporary number is usually the current number.
But it is possible to use any extension, so the extension for a device can be changed any time.
### Disconnect
`exit`
Disconnect telnet session.
### Stop controller
`stop`
Shutdown the controller, but FieldPOC continues running.