JSON API » peers » peers/create

Creates a new peer.

Input parameters

Requires authentication and the system role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
nameStringName.Yes
typeStringType. "context", "dahdi", "iax", "sip", or "zap".Yes
called_prefixStringPrefix to prepend to called number.NoEmpty string.
called_strip_hashInteger1 to strip trailing # characters from called number, 0 not.No0
calleridStringCallerid to force. Empty string for existing.NoEmpty string.
callerid_unknownStringCallerid when unknown. Empty string for none.No"Anonymous"
callerid_withheldStringCallerid when withheld. Empty string for none.No"Anonymous"
channel_groupIntegerDAHDI or Zap channel group.Yes if type=dahdi or type=zap.1
chargeInteger1 to charge customers for calls, 0 not to.No1
codecsStringList of acceptable codecs, separated by commas.No"alaw,g722,g726,g729,gsm,ilbc,lpc10,slin,speex,ulaw"
contextStringextensions.conf context.Yes if type=context.Empty string.
currencyStringCurrency costs are in.NoDefault currency.
customerIntegerID of customer to reserve for. 0 for none. -1 for all.No0
descriptionStringDescription.NoEmpty string.
destinationStringSIP or IAX destination(s) to send calls to.Yes if type=iax or type=sip.Empty string.
dialplan_calledStringDial plan called number is sent in.NoDefault dial plan.
dialplan_callerStringDial plan callerid is sent in.NoDefault dial plan.
dtmfmodeStringDTMF mode. "inband", "info", or "rfc2833".No"rfc2833"
fail_percentIntegerPercentage of calls to fail.No0
outmaximumIntegerMaximum concurrent calls. -1 for no limit.No-1
passwordStringSIP or IAX password to send.NoEmpty string.
plan_customerIntegerID of customer (and children) allowed to create routing exceptions to this peer. 0 for none, -1 for all.No-1
proxyStringSIP proxy to send calls via. Empty string to send direct.NoEmpty string.
send_asserted_identityInteger1 to send the P-Asserted-Identity SIP header, 0 not to.No0
send_privacyInteger1 to send the Privacy SIP header, 0 not to.No0
send_rpidInteger1 to send the Remote-Party-ID SIP header, 0 not to.No0
url_costsStringA URL to look up costs. Normally empty string.NoEmpty string.
usernameStringSIP or IAX username to send.NoEmpty string.
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
200Success.
201Input passed validation. Only returned if validation=1.
400Invalid input parameters specified. Check the key and message fields for more details.
401The authentication details provided are invalid.
402Your 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

VersionChanges
3.13Function added.