JSON API » phones » phones/create
Creates a new telephone line.
Input parameters
Requires authentication and the administrator or wholesale role privileges.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| name | String | SIP username. | Yes | |
| password | String | SIP password. | Yes, unless copy_password is specified. | |
| acr | Integer | 1 to reject calls with unknown or withheld callerid, 0 not to. | No | 0 |
| allowed_ua | String | SIP User Agents that are allowed to register on this telephone line. | No | |
| aoc | Integer | 1 to send advice of charge, 0 not to. | No | 0 |
| btype | String | Destination type on busy. | No | "hangup" |
| bnumber | String | Destination number on busy. | No | Empty string. |
| call_maximum | Decimal | Maximum spending per day. -1 for no limit. | No | -1 |
| callerid_external | String | Callerid on external calls. A number, "default", "matched_called", "name", "original", or "original_own_number". | No | "default" |
| callerid_internal | String | Callerid on internal calls. A number, "default", "name", "original", or "original_own_number". | No | "default" |
| callerid_location | String | Location callerid. A number, "original_own_number", or empty string for none. | No | Empty string. |
| callername_external | String | Caller name on external calls. | No | Empty string. |
| callername_internal | String | Caller name on internal calls. | No | Empty string. |
| codec | String | Preferred codec. Empty string for any. | No | Empty string. |
| copy_password | String | Another telephone line in the same customer to copy the password from. Empty string to use the password parameter instead. | No | Empty string. |
| cos | Integer | ID of class of service. 0 for default. 1 for system COS that allows all calls. | No | 0 |
| customer | Integer | ID of customer to create in. | No | Customer of authentication user. |
| description | String | Description. | No | Empty string. |
| delivery | String | "register" to send registration as request URI, "last_number" to send last called number. | No | "register" |
| dialplan | String | Dial plan. Empty string for default. | No | Empty string. |
| direct | Integer | 1 to allow callers to enter this number in IVR menus and the auto-attendant, 0 not to. | No | 1 |
| dnd | Integer | 1 to reject all calls, 0 not to. | No | 0 |
| dtype | String | Destination type on no answer. | No | "hangup" |
| dnumber | String | Destination number on no answer. | No | Empty string. |
| emergency_address1 | String | Line 1 of the emergency address. | No | Empty string. |
| emergency_address2 | String | Line 2 of the emergency address. | No | Empty string. |
| emergency_address3 | String | Line 3 of the emergency address. | No | Empty string. |
| emergency_address_city | String | City of emergency address. | No | Empty string. |
| emergency_address_state | String | State of emergency address. | No | Empty string. |
| emergency_address_code | String | Post or zip code of emergency address. | No | Empty string. |
| emergency_address_other | String | Other emergency address information. | No | Empty string. |
| emergency_country | String | Country of emergency address. | No | Empty string. |
| emergency_location_code | String | Emergency location code. Normally empty string. | No | Empty string. |
| expect_registered | Integer | 0 if not expected to be registered and no unregistered alerts should be sent, 1 if expected to be registered, 2 if expected to be registered and alerts of phone address changes should be sent. | No | 1 |
| forwarding | String | Forward all calls to this number. Empty string for none. | No | Empty string. |
| use_forwarding | Integer | 1 to enable use of forwarding number, 0 not to. | No | 1 |
| hardware_address | String | Hardware address, such as MAC address. | No | Empty string. |
| language | String | Language code. Empty string for default. | No | Empty string. |
| ltype | String | "phone" if logged in as a virtual phone, empty string if not. | No | Empty string. |
| lnumber | String | Telephone line logged in on top of as virtual phone. Empty string for none. | No | Empty string. |
| mailbox | String | Mailbox for message waiting indicator and direct mailbox access.i Empty string for none. | No | Empty string. |
| media | String | "voice" or "fax". | No | "voice" |
| missedemail | Integer | 1 to send owner notification of missed calls if owner set, 0 not to. | No | 0 |
| music | Integer | ID of music on hold. 0 for default. | No | 0 |
| music_ringing | Integer | 1 to play music to caller when ringing, 0 to play ringing. | No | 0 |
| owner | Integer | ID of owner. 0 for none. | No | 0 |
| panel | Integer | 1 to display in control panel, 0 not to. | No | 0 |
| pin | String | PIN. Empty string for none. | No | Empty string. |
| ping | Integer | 1 to SIP ping handset, 0 not to. | No | 0 |
| plan | Integer | ID of rate plan. 0 for default. | No | 0 |
| presentation_external | Integer | Presentation on external calls. | No | 1 |
| presentation_internal | Integer | Presentation on internal calls. | No | 1 |
| provision1 | String | Special provisioning data. | No | Empty string. |
| provisioning | Integer | ID of provisioning template. 0 for automatic or if provisioning is not enabled. | No | 0 |
| recordgroup | Integer | ID of record group. 0 for none. | No | 0 |
| registrar | String | Hostname to register to for provisioning. Empty string to use rate plan SIP domain. | No | Empty string. |
| ringtime | Integer | Ring time in seconds. | No | 15 |
| screen | Integer | 1 to screen calls and play callerid, 2 to ask callers to record name, 0 not to screen. | No | 0 |
| source | String | Only allow from this IP address. Empty string for any. | No | Empty string. |
| totalmaximum | Integer | Maximum number of calls to allow to/from telephone. -1 for no limit. | No | -1 |
| utype | String | Destination type on unregistered. | No | "hangup" |
| unumber | String | Destination number on unregistered. | No | Empty string. |
| unumber_group | Integer | 1 to follow the utype and unumber on group calls, 0 not to. | No | |
| validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
| Code | Description |
|---|---|
| 201 | Input passed validation. Only returned if validation=1. |
| 204 | Success. |
| 400 | Invalid input parameters specified. Check the key and message fields for more details. |
| 401 | The authentication details provided are invalid. |
| 402 | Your role does not allow this. |
| 403 | Your rate plan does not allow this. |
Data returned
No data is returned.
Example: With required parameters
http://enswitch.example.com/api/json/phones/create/?auth_username=user;auth_password=password;name=1234567;password=secret{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }
Change history
| Version | Changes |
|---|---|
| 4.4 | callerid_external parameter values updated. |
| 4.4 | presentation_internal, allowed_ua parameter added. |
| 4.0 | use_forwarding parameter added. |
| 3.14 | aoc input parameter added. cos input parameter changed to allow 0 for default and 1 to allow all calls. expect_registered input parameter changed to allow 2 for expected registered and alert for address changes. |
| 3.13 | Function added. |
