api:pbx:backup:restore
Table of Contents
API : PBX : Backup restore
Introduction
Restores a PBX backup from an uploaded backup ZIP file onto a target customer. To restore a backup stored on the file server, use Restore stored instead.
All restored items get new ids - every reference between the restored items (gotos, audio references, music on hold, users, phones, softkeys) is rewritten accordingly.
Two restore modes exist:
| Mode | Description |
|---|---|
| replace | The existing configuration in the selected categories is deleted from the target customer before the backup is restored. Users are never deleted - they are matched by email address. Use for disaster recovery. |
| deploy | The backup is added on top of the target customers existing configuration. Conflicts (internal numbers, MAC addresses) are reported as warnings. Use for deploying a template onto another customer. |
Behavior worth knowing:
- Phone numbers (trunk numbers, direct numbers) are only restored if the target customer owns them - other numbers are dropped and reported.
- Users are matched on the target customer by email address, or - for users without an email address - by name, title, department and access level (the first match is used when several fit). Matched users keep their current identity and credentials and only receive the backed up PBX settings. Users that do not exist are recreated with their backed up access level, email address and login credentials when possible; when that fails (e.g. the email address is in use on another customer) they are created as NO_LOGIN without an email address and must be invited afterwards.
- SIP phones keep their MAC address if it is free; a MAC in use by another phone is cleared and reported. SIP credentials are always regenerated.
- Communicator dashboards on the target customer are automatically repointed at the restored queues, extensions and groups.
- A restore takes a per-customer lock - only one restore can run per customer at a time.
- Use dryRun to validate the restore and get the full report with all warnings, without changing anything.
Request
| URL | https://api.telecomx.dk/pbx/backup/restore | |
|---|---|---|
| Method | POST (multipart/form-data) | |
| Access level | OWNER if the target is the users own customer. RESELLER if the customer belongs to the reseller. RESELLER_ADMIN and ADMIN for all customers. |
|
| Fields | file | The backup ZIP file, max 500 MB. |
| customer | [optional] Id of the target customer. Defaults to the users own customer. |
|
| mode | Restore mode: replace or deploy. | |
| include | [optional] Comma separated subset of categories to restore. Defaults to everything the backup contains. Must be categories that exist in the backup. |
|
| dryRun | [optional] true to only validate and report conflicts without changing anything. Default false. |
|
Response
The restore report:
| JSON object | ||
|---|---|---|
| Property | Type | Description |
| mode | String | The restore mode that was used: replace or deploy. |
| dryRun | Boolean | True if this was a test run and nothing was changed. |
| categories | Array | The categories that were restored. |
| created | Object | Number of items created per category, e.g. { dialplan: 42, audio: 17 }. |
| updated | Object | Number of items updated in place per category (e.g. users matched by email address). |
| warnings | Array | List of warnings, see definition below. |
| Warning object | ||
|---|---|---|
| Property | Type | Description |
| type | String | Warning type, see the table below. |
| item | String | What the warning relates to - an item name, phone number, email address or MAC address. |
| message | String | Human readable description of what happened. |
| Warning type | Description |
|---|---|
| NUMBER_DROPPED | A phone number in the backup is not owned by the target customer and was dropped. |
| EXTENSION_NUMBER_IN_USE | An internal extension number is already in use on the target customer - the item was restored without a number. |
| MAC_IN_USE | A SIP phone MAC address is in use by another phone - the phone was restored without a MAC address. |
| USER_CREATED_NO_LOGIN | A user did not exist on the target customer and was created as NO_LOGIN without an email address. |
| USER_SKIPPED | A user could not be created on the target customer (e.g. no valid PBX user product) and was skipped. |
| PRODUCT_MISSING | A referenced product does not exist - the reference was removed. |
| MODEL_MISSING | A referenced SIP phone model does not exist - the phone was skipped. |
| AUDIO_REF_NULLED | An audio reference could not be resolved (audio category not included or file missing) and was cleared. |
| GLOBAL_MOH_MISSING | A referenced shared music on hold class no longer exists - the reference was cleared. |
| VARIABLE_EXISTS | A variable or switch already exists on the target and was not overwritten (deploy mode). |
| VARIABLE_DROPPED | A personal variable belonged to a user that could not be resolved on the target and was dropped. |
| TTS_VOICE_MISSING | A referenced TTS voice no longer exists - playback may fail until a new voice is selected. |
| AUDIO_DOWNLOAD_FAILED | An audio file could not be downloaded from the audio file server when the backup was created. |
| PICTURE_FAILED | The picture of a user could not be backed up or restored. |
| EMPLOYEE_REF_NULLED | An extension referenced a user that could not be resolved on the target customer - restored without a user. |
| EXTENSION_REF_NULLED | An extension reference could not be resolved (dialplan category not included) and was cleared. |
| UNRESOLVED_REFERENCE | A reference (e.g. a value router target) could not be resolved on the target customer and was left as-is. |
Example
{ mode: 'deploy', dryRun: false, categories: [ 'dialplan', 'audio', 'users' ], created: { dialplan: 42, audio: 17, users: 3 }, updated: { users: 8 }, warnings: [ { type: 'NUMBER_DROPPED', item: '+4512345678', message: 'The phone number is not owned by the target customer and was dropped - attach a number manually' } ] }
Errors
| Error code | Message | Description |
|---|---|---|
| 403 | access_denied | Insufficient access level |
| 404 | customer | Customer not found |
| 404 | file | No backup file was uploaded |
| 409 | restore | A restore is already running for this customer |
| 422 | file | The file is not a valid PBX backup, or has a newer format version than the server supports |
| 422 | include | The backup does not contain the selected categories |
| 422 | options | Invalid restore options |
| 500 | internal_error | <Unspecified> |
api/pbx/backup/restore.txt · Last modified: by Per Møller