Numeri
I numeri telefonici (DID) sono assegnati all'azienda da Exobyte. L'azienda decide dove indirizzare le chiamate ricevute. Scope numbers:read / numbers:write.
Destinazione di un numero
curl -s "https://centralino.exovoip.it/api/v1/numbers?limit=100" -H "X-API-Key: $EXOPBX_API_KEY"
curl -s -X PATCH https://centralino.exovoip.it/api/v1/numbers/7 \
-H "X-API-Key: $EXOPBX_API_KEY" -H "Content-Type: application/json" \
-d '{"description":"Centralino","destination":{"type":"ivr","ivrId":2}}'const { items: numbers } = await pbx.numbers.list({ limit: 100 });
await pbx.numbers.update(7, { description: 'Centralino', destination: { type: 'ivr', ivrId: 2 } });$numbers = $pbx->numbers->list(limit: 100)['items'];
$pbx->numbers->update(7, ['description' => 'Centralino', 'destination' => ['type' => 'ivr', 'ivrId' => 2]]);numbers = pbx.numbers.list(limit=100)["items"]
pbx.numbers.update(7, {"description": "Centralino", "destination": {"type": "ivr", "ivrId": 2}})La destinazione è un oggetto Destination, usato in tutto il centralino (numeri, regole, menu, code):
type | Campi | Effetto |
|---|---|---|
extension | extensionId | Squilla un interno |
ring_group | ringGroupId | Squilla un gruppo |
queue | queueId | Entra in coda |
ivr | ivrId | Menu vocale |
voicemail | extensionId, greeting? | Segreteria di un interno |
playback | promptId, then? | Riproduce un messaggio, poi prosegue |
mobile | number, confirm?, ringTimeS? | Inoltro a un numero esterno |
calendar | calendarId, open?, closed? | Destinazione diversa secondo gli orari |
hangup / busy | — | Chiude la chiamata / segnale di occupato |
Per catene più articolate (più passaggi in sequenza, filtri per chiamante o linea) usa le regole in entrata.
Orari di un numero
Ogni numero può seguire un calendario: in orario segue la sua destinazione, fuori orario la destinazione di chiusura.
curl -s -X PUT https://centralino.exovoip.it/api/v1/numbers/7/calendar \
-H "X-API-Key: $EXOPBX_API_KEY" -H "Content-Type: application/json" \
-d '{"calendarId":4,"closedDestination":{"type":"voicemail","extensionId":12}}'await pbx.numbers.setCalendar(7, {
calendarId: 4,
closedDestination: { type: 'voicemail', extensionId: 12 },
});$pbx->numbers->setCalendar(7, ['calendarId' => 4, 'closedDestination' => ['type' => 'voicemail', 'extensionId' => 12]]);pbx.numbers.set_calendar(7, {"calendarId": 4, "closedDestination": {"type": "voicemail", "extensionId": 12}})Gestione dei numeri (piattaforma)
Aggiunta al pool, aggiunta massiva, assegnazione a un'azienda e a una linea, rimozione: solo chiavi globali.
curl -s -X POST https://centralino.exovoip.it/api/v1/numbers -H "X-API-Key: $EXOPBX_API_KEY" \
-H "Content-Type: application/json" -d '{"number":"+390981123456","description":"Centralino"}'
curl -s -X PUT https://centralino.exovoip.it/api/v1/numbers/7/assignment -H "X-API-Key: $EXOPBX_API_KEY" \
-H "Content-Type: application/json" -d '{"tenantId":3,"trunkId":1}'const { number } = await pbx.numbers.create({ number: '+390981123456', description: 'Centralino' });
await pbx.numbers.assign(number.id, { tenantId: 3, trunkId: 1 });$n = $pbx->numbers->create(['number' => '+390981123456', 'description' => 'Centralino'])['number'];
$pbx->numbers->assign($n['id'], ['tenantId' => 3, 'trunkId' => 1]);n = pbx.numbers.create({"number": "+390981123456", "description": "Centralino"})["number"]
pbx.numbers.assign(n["id"], {"tenantId": 3, "trunkId": 1})Endpoint
| Descrizione | Richiesta | Scope | Metodo SDK |
|---|---|---|---|
| Elenco numeri | GET /v1/numbers | numbers:read | numbers.list() |
| Aggiunge numero al pool | POST /v1/numbers | numbers:write | numbers.create() |
| Aggiunta massiva numeri | POST /v1/numbers/bulk | numbers:write | numbers.bulkCreate() · py: numbers.bulk_create() |
| Dettaglio numero | GET /v1/numbers/:id | numbers:read | numbers.get() |
| Destinazione e descrizione del numero | PATCH /v1/numbers/:id | numbers:write | numbers.update() |
| Rimuove numero dal pool (solo se libero) | DELETE /v1/numbers/:id | numbers:write | numbers.delete() |
| Assegna/libera numero e linea | PUT /v1/numbers/:id/assignment | numbers:write | numbers.assign() |
| Calendario e destinazione di chiusura del numero | GET /v1/numbers/:id/calendar | numbers:read | numbers.getCalendar() · py: numbers.get_calendar() |
| Assegna calendario e destinazione di chiusura al numero | PUT /v1/numbers/:id/calendar | numbers:write | numbers.setCalendar() · py: numbers.set_calendar() |
