api:pbx:trunk:create
Table of Contents
API : PBX : Trunk Create
Introduction
A trunk is an entrypoint into the PBX from the outside world. A trunk holds one or more public numbers that leads into the PBX.
The trunks task is to receive the calls and send them into the next dialplan item that shall handle the call.
A trunk may also be in FAX mode, where it instead acts as a fax receiver, sender or both.
Request
This request will create a trunk. All properties are optional except for customer and name.
| URL | https://api.telecomx.dk/pbx/trunk | ||
|---|---|---|---|
| Method | POST | ||
| Access level | MANAGER or OWNER if user belongs to the customer. RESELLER if customer belongs to the reseller. ADMIN. |
||
| Body | customer | Id | Id of the customer the trunk belongs to. |
| name | String | Name/description of the trunk. | |
| number | String | [optional] The phone number to dial to reach this trunk locally. Null if not used. |
|
| startAudio | Id | [optional] A sound item to playback when the trunk is entered. |
|
| redirect | String | [optional] Number to redirect to when execution starts. Used to quickly circumvent the trunk. Null if not used. |
|
| notes | String | Notes about the trunk. | |
| numbers | Array | Array of phone numbers (E.164 format) that are handled by the trunk, Fixed line and mobile phones marked for PBX usage can be used. | |
| selectable | Boolean | True if the numbers on this trunk may be used by employees for outbound number presentation. | |
| language | String | Language to use for voice prompts against the caller: da or en. | |
| ringtone | Number | If an alternative ringtone should be used on supported SIP phones, this is the index of it (1-19). 0 for silent ringtone, -1 to not override it. | |
| musicOnHold | Id | Id of music on hold class to set, null if not used. | |
| goto | Id | Id of dialplan item to send inbound calls to. | |
| Fax | |||
| fax.mode | String | Fax mode: OFF - used as normal trunk. RECEIVE - receive fax only. SEND - Send fax only. BOTH - send and receive fax. |
|
| fax.retension | Number | Number of days to keep received faxes, 1-90 days, 0 to not store faxes and only e-mail them. Only used when fax.mode is not off. | |
| fax.email | String | E-mail address to send received faxes to. Only used when fax.mode is not OFF. | |
Request body example
{ customer: '12345678901234567890DDDD', name: 'Primary fax trunk CPH', number: '800', startAudio: null, redirect: null, notes: 'Faxing only', numbers: [ '+4570305051', '+4570305052' ], selectable: false, language: 'da', ringtone: -1, musicOnHold: null, goto: null, pbx: { mode: 'BOTH', retension: 7, email: 'info@telecomx.dk' } }
Response
| JSON object | ||
|---|---|---|
| _id | Id | Unique id of the extension. |
| type | String | Always 'TRUNK'. |
| name | String | Name of the trunk. |
| number | String | The phone number to dial to reach this trunk, null if it is not dial-able. |
| startAudio | Id | A sound item to playback when the trunk is entered, null if not used. |
| redirect | String | Number to redirect to when execution starts. Used to quickly circumvent the trunk. |
| notes | String | Notes about the trunk. |
| numbers | Array | Array of phone numbers (E.164 format) that are handled by the trunk, Fixed line and mobile phones marked for PBX usage can be used. |
| selectable | Boolean | True if the numbers on this trunk may be used by employees for outbound number presentation. |
| language | String | Language to use for voice prompts against the caller: da or en. |
| ringtone | Number | If an alternative ringtone should be used on supported SIP phones, this is the index of it (1-19). 0 for silent ringtone, -1 to not override it. |
| musicOnHold | Id | Id of music on hold class to set, null if not used. |
| goto | Id | Id of dialplan item to send inbound calls to. |
| Fax | ||
| fax.mode | String | Fax mode: OFF - used as normal trunk. RECEIVE - receive fax only. SEND - Send fax only. BOTH - send and receive fax. |
| fax.retension | Number | Number of days to keep received faxes, 1-90 days, 0 to not store faxes and only e-mail them. Only used when fax.mode is not off. |
| fax.email | String | E-mail address to send received faxes to. Only used when fax.mode is not OFF. |
Example
{ _id: '12345678901234567890ABCD', name: 'Primary fax trunk CPH', number: '800', startAudio: null, redirect: null, notes: 'Faxing only', numbers: [ '+4570305051', '+4570305052' ], selectable: false, language: 'da', ringtone: -1, musicOnHold: null, goto: null, pbx: { mode: 'BOTH', retension: 7, email: 'info@telecomx.dk' } }
Errors
| Error code | Message | Description |
|---|---|---|
| 404 | customer | Customer not found or not active |
| 422 | name | Name must be at least 3 characters |
| 409 | number | Number is in use by another dialplan item |
| 422 | number | Number is invalid, only 0-9 is allowed and no public service numbers |
| 422 | redirect | Redirect number is invalid, only + 0-9, # and * is allowed |
| 404 | redirect | Redirect number is local but does not point to an existing dialplan item |
| 404 | startAudio | Start audio file not found |
| 404 | musicOnHold | The music on hold class does not exist |
| 404 | goto | Dialplan item not found |
| 409 | numbers | One or more numbers are not available |
| 409 | numbers | One or more numbers are already in use |
| 422 | retension | Retension must be between 0 and 90 days |
| 422 | fax.mode | Invalid mode, use OFF, RECEIVE, SEND or BOTH |
| 422 | fax.email | Not a valid e-mail address |
| 422 | ringtone | Invalid ringetone |
| 422 | language | Invalid language, use en or da |
| 403 | access_denied | Insufficient access level |
| 500 | internal_error | <Unspecified> |
api/pbx/trunk/create.txt · Last modified: 2018/08/20 13:26 by Per Møller