This request moves phone numbers from one SIP account to another SIP account of the same customer - between two standalone SIP trunks, between two hosted PBX trunks, or between a PBX trunk and a standalone trunk.
A move keeps the numbers exactly as they are and only changes which SIP account holds them: the state, live date, listing in phone books, the user (employee) or name, the number's own address (addressOverride) and an ongoing porting all stay. Removing a number from one account with Update and adding it to another would instead release the number in between, delete its voicemail messages, and is refused when the hosted PBX uses the number.
The hosted PBX routes inbound calls by number, never by SIP account, so what happens depends on the two accounts (kind in the reply):
| kind | Accounts | What happens |
|---|---|---|
| STANDALONE | standalone → standalone | Nothing on the hosted PBX. |
| PBX_INTERNAL | PBX trunk → PBX trunk on the same PBX cluster | Nothing on the hosted PBX - calls to the numbers are handled exactly as before. Never refused because of the PBX. |
| LEAVES_PBX | PBX trunk → standalone, or PBX trunk → PBX trunk on another cluster | The numbers leave the customer's hosted PBX, and everything on the PBX that refers to them is changed (see below). Refused if one of the numbers is the PBX default number (defaultNumber in PBX settings) - change that first. |
| ENTERS_PBX | standalone → PBX trunk | The numbers get no PBX routing until they are added to a TRUNK item (hovednummer) or set as the direct number of an extension. |
When the numbers leave the PBX, these references are changed automatically - use dryRun first to see them (a dry run also requires write access to the PBX when there are references):
| Dialplan item | Field | Change |
|---|---|---|
| TRUNK | numbers | The numbers are removed from the TRUNK item. |
| EXTENSION | direct | The direct number is cleared. |
| EXTENSION | outbound.callerId.onPresenceWork, outbound.callerId.onPresenceOffWork | Falls back to the default: the extension's direct number if it keeps one, otherwise the PBX default number (resetTo in the reply). |
| EXTENSION | outbound.callerId.onNextCall | Cleared. |
| DIAL | callerIdNumber (callerId NUMBER) | callerId is set to ASIS (the caller's number is presented). |
| QUEUE | outboundCallerIdNumber (outboundCallerId NUMBER) | outboundCallerId is set to DEFAULT (the caller's number is presented to external members). |
Each changed dialplan item is logged in the change log and announced on the realtime channel (PBX_<TYPE>_UPDATED) like any other update of it. When an extension loses its direct number, the search data of its user and SIP phones is updated too. Changing the PBX requires write access to the customer's PBX as well.
| URL | https://api.telecomx.dk/sip/ACCOUNT_ID/numbers/move | ||
|---|---|---|---|
| Method | POST | ||
| Access level | MANAGER or OWNER when user belongs to the customer. RESELLER if customer belongs to the reseller. ADMIN. A move that changes the hosted PBX (LEAVES_PBX with references) also requires write access to the customer's PBX. |
||
| Param | ACCOUNT_ID | Id of the SIP account the numbers are on (24 hex-char string) | |
| Body | to | Id | Id of the SIP account to move the numbers to - must belong to the same customer. |
| numbers | Array | The numbers to move, in E.164 format (1 to 10000). A number of a series brings the whole series along. | |
| dryRun | Boolean | [optional] True to only report what the move would do - nothing is changed. Default false. |
|
{ to: '1234567890ABCDEF12345679', numbers: ['+4570305010', '+4570305011'], dryRun: true }
The same for a dry run and a real move - a real move adds done.
| Json object | ||
|---|---|---|
| dryRun | Boolean | True if nothing was changed. |
| from | Id | Id of the SIP account the numbers are moved from. |
| to | Id | Id of the SIP account the numbers are moved to. |
| numbers | Array | The numbers moved, sorted - the requested numbers plus the rest of their series. |
| kind | String | STANDALONE, PBX_INTERNAL, LEAVES_PBX or ENTERS_PBX - see Hosted PBX. |
| dependencies | Array | The PBX references that are changed (LEAVES_PBX only), one per reference. |
| dependencies[].type | String | Type of dialplan item: TRUNK, EXTENSION, DIAL or QUEUE. |
| dependencies[].id | Id | Id of the dialplan item. |
| dependencies[].name | String | Name of the dialplan item. |
| dependencies[].itemNumber | String | Local number of the dialplan item (e.g. the extension number), null if none. |
| dependencies[].field | String | The field that refers to the number - see the table above. |
| dependencies[].number | String | The phone number referred to. |
| dependencies[].action | String | REMOVE (removed from the TRUNK item), CLEAR (field cleared) or RESET (caller id falls back to its default). |
| dependencies[].resetTo | String | Only for RESET of an extension caller id: the number presented afterwards, null if the extension keeps no direct number and the PBX has no default number. |
| warnings | Array | Things to know before moving - none of them stops the move. |
| warnings[].code | String | SERIES_EXPANDED - numbers were added because a series moves as a whole (numbers). TARGET_INACTIVE - the new SIP account is not active. TARGET_DELETE_DATE - the new SIP account is scheduled for deletion (date). ENTERS_PBX - the numbers get no PBX routing until added to a TRUNK item or an extension (also given when they move to a PBX trunk on another cluster). RATE_PLAN_DIFFERS - the accounts have different rate plans (not given when one of them is included in another SIP account). BILLING_DIFFERS - the accounts have different billing customers or parent SIP accounts. ADDRESS_DIFFERS - the accounts have different addresses, and these numbers (numbers) have no address of their own, so their 112 calls get the new account's address. DEFAULT_NUMBER_CHANGED - the default number of the source account moves, number is its new default number (empty if no numbers are left). PORTING_IN - count ongoing in-portings now deliver their numbers (numbers) to the new account. VOICEMAIL_MESSAGES - count voicemail messages move along, hasVoicemail is false if the new account has no voicemail of its own (always for a hosted PBX trunk). |
| warnings[].numbers | Array | Numbers the warning is about. |
| warnings[].count | Number | Number of items the warning is about. |
| warnings[].date | Date | Date the warning is about. |
| warnings[].number | String | Number the warning is about. |
| warnings[].hasVoicemail | Boolean | VOICEMAIL_MESSAGES only. |
| done | Object | Real move only - what was changed. |
| done.numbers | Number | Numbers moved. |
| done.portings | Number | In-portings now delivering to the new account. |
| done.voicemailMessages | Number | Voicemail messages moved along. |
| done.pbxItems | Number | PBX dialplan items changed. |
{ dryRun: true, from: '1234567890ABCDEF12345678', to: '1234567890ABCDEF12345679', numbers: ['+4570305010', '+4570305011'], kind: 'LEAVES_PBX', dependencies: [ { type: 'TRUNK', id: '1234567890ABCDEF1234567A', name: 'Hovednummer', itemNumber: null, field: 'numbers', number: '+4570305010', action: 'REMOVE' }, { type: 'EXTENSION', id: '1234567890ABCDEF1234567B', name: 'Per', itemNumber: '201', field: 'direct', number: '+4570305010', action: 'CLEAR' }, { type: 'EXTENSION', id: '1234567890ABCDEF1234567B', name: 'Per', itemNumber: '201', field: 'outbound.callerId.onPresenceWork', number: '+4570305010', action: 'RESET', resetTo: '+4570305000' } ], warnings: [ { code: 'ADDRESS_DIFFERS', numbers: ['+4570305010'] } ] }
A number that cannot move gives one error per number with the code numbers[E.164Number]. Several such errors are returned together as a 422 multiple error, with the single errors in inner. Invalid input in the request body gives only the first error found.
| Error code | Message | Description |
|---|---|---|
| 403 | access_denied | Insufficient access level - also when the customer lacks the SIP feature, or the move changes the hosted PBX and the user has no write access to the PBX |
| 404 | id | SIP account not found |
| 404 | to | The SIP account to move the numbers to was not found |
| 404 | to, numbers | Missing (check: required) |
| 409 | to | The numbers are already on this SIP account (check: same_account) |
| 409 | to | Numbers can only be moved between SIP accounts of the same customer (check: other_customer) |
| 409 | numbers[E.164Number] | The number is not on the SIP account (check: not_on_account) |
| 409 | numbers[E.164Number] | The number is being ported out and cannot be moved (check: porting_out) |
| 409 | numbers[E.164Number] | The number is ported in together with other numbers - all numbers of the porting must be moved together (check: porting_partial) |
| 409 | numbers[E.164Number] | The number is the default number of the hosted PBX - change the default number of the PBX first (check: pbx_default_number) |
| 409 | numbers | The numbers on the SIP account changed while moving them - please try again (check: changed) |
| 422 | id, to | Invalid ObjectId |
| 422 | numbers | At least one number is required |
| 422 | numbers | Too many numbers |
| 422 | numbers[N] | Number is not valid E.164 formatted |
| 422 | multiple | Multiple errors - see inner |
| 500 | internal_error | <Unspecified> |