JSON API » peers » peers/create
Creates a new peer.
Input parameters
Requires authentication and the system role privilege.
Name | Type | Description | Required | Default value |
---|---|---|---|---|
auth_username | String | Authentication username. | Yes | |
auth_password | String | Authentication password. | Yes | |
name | String | Name. | Yes | |
type | String | Type. "context", "dahdi", "iax", "sip", or "zap". | Yes | |
called_prefix | String | Prefix to prepend to called number. | No | Empty string. |
called_strip_hash | Integer | 1 to strip trailing # characters from called number, 0 not. | No | 0 |
callerid | String | Callerid to force. Empty string for existing. | No | Empty string. |
callerid_unknown | String | Callerid when unknown. Empty string for none. | No | "Anonymous" |
callerid_withheld | String | Callerid when withheld. Empty string for none. | No | "Anonymous" |
channel_group | Integer | DAHDI or Zap channel group. | Yes if type=dahdi or type=zap. | 1 |
charge | Integer | 1 to charge customers for calls, 0 not to. | No | 1 |
codecs | String | List of acceptable codecs, separated by commas. | No | "alaw,g722,g726,g729,gsm,ilbc,lpc10,slin,speex,ulaw" |
context | String | extensions.conf context. | Yes if type=context. | Empty string. |
costs | Integer | 1 if peer has own costs, 0 if peer uses system costs. | No | 0 |
currency | String | Currency costs are in. | No | Default currency. |
customer | Integer | ID of customer to reserve for. 0 for none. -1 for all. | No | 0 |
description | String | Description. | No | Empty string. |
destination | String | SIP or IAX destination(s) to send calls to. | Yes if type=iax or type=sip. | Empty string. |
dialplan_called | String | Dial plan called number is sent in. | No | Default dial plan. |
dialplan_caller | String | Dial plan callerid is sent in. | No | Default dial plan. |
dtmfmode | String | DTMF mode. "inband", "info", or "rfc2833". | No | "rfc2833" |
fail_percent | Integer | Percentage of calls to fail. | No | 0 |
outmaximum | Integer | Maximum concurrent calls. -1 for no limit. | No | -1 |
password | String | SIP or IAX password to send. | No | Empty string. |
plan_customer | Integer | ID of customer (and children) allowed to create routing exceptions to this peer. 0 for none, -1 for all. | No | -1 |
proxy | String | SIP proxy to send calls via. Empty string to send direct. | No | Empty string. |
send_asserted_identity | Integer | 1 to send the P-Asserted-Identity SIP header, 0 not to. | No | 0 |
send_privacy | Integer | 1 to send the Privacy SIP header, 0 not to. | No | 0 |
send_rpid | Integer | 1 to send the Remote-Party-ID SIP header, 0 not to. | No | 0 |
url_costs | String | A URL to look up costs. Normally empty string. | No | Empty string. |
username | String | SIP or IAX username to send. | No | Empty string. |
validation | Integer | 1 to validate input then return, 0 for full action. | No | 0 |
Responses
Code | Description |
---|---|
200 | Success. |
201 | Input passed validation. Only returned if validation=1. |
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. |
Data returned
The ID of the created peer.
Example: SIP carrier
http://enswitch.example.com/api/json/peers/create/?auth_username=user;auth_password=password;name=example;type=sip;destination=sip.example.com{ "responses":[ { "code":"200", "key":"", "message":"OK" } ], "data":{ "id":123 } }
Change history
Version | Changes |
---|---|
3.15 | costs input parameter added. |
3.13 | Function added. |