JSON API » peers » peers/costs/create

Creates a new peer cost. This cost is only used if the peer has an independent costs table.

Input parameters

Requires authentication and the system owner role privilege.

NameTypeDescriptionRequiredDefault value
auth_usernameStringAuthentication username.Yes
auth_passwordStringAuthentication password.Yes
peerIntegerID of peer.Yes
called_maxIntegerMaximum length of called number to match.No100
called_minIntegerMinimum length of called number to match.No1
called_prefixStringCalled prefix to match. Empty string for any.NoEmpty string.
caller_prefixStringCallerid prefix to match. Empty string for any.NoEmpty string.
connectfeeDecimalA connect fee charged on answer.No0.00
costDecimalThe cost per minute after the included seconds are used.No0.00
daysStringDays time chunk is active. Monday = 1, Sunday = 7. For example, "12345" for Monday to Friday.No"1234567"
descriptionStringDescription.NoEmpty string.
endIntegerThe Unix timestamp after which this cost no longer applies. -1 for never.No-1
endhourIntegerEnd hour from 0 to 23.No23
endminuteIntegerEnd minute from 0 to 59.No59
includedIntegerThe number of seconds included free with the connectfee.No0
incrementIntegerBilling increment in seconds.No1
mediaStringMedia type. "fax", "voice", or "voice_fax".No"voice_fax"
messageDecimalThe cost to send a message.No0.00
minimumDecimalAn overall minimum cost for the call if answered.No0.00
priorityIntegerThe priority from 1 to 10.No1
startIntegerThe Unix timestamp from which this cost applies.No-1
starthourIntegerStart hour from 0 to 23.No0
startminuteIntegerStart minute from 0 to 59.No0
validationInteger1 to validate input then return, 0 for full action.No0

Responses

CodeDescription
201Input passed validation. Only returned if validation=1.
204Success.
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

No data is returned.

Example: With required parameters

http://enswitch.example.com/api/json/peers/costs/create/?auth_username=user;auth_password=password;peer=123

{ "responses":[ { "code":"204", "key":"", "message":"OK" } ] }

Change history

VersionChanges
3.15Function added.