JSON API » peers » peers/costs/update

Updates an existing peer cost.

Input parameters

Requires authentication and the system owner role privilege.

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

Responses

CodeDescription
204Success.
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.
404The peer cost does not exist.

Data returned

No data is returned.

Example: Changing the called number prefix

http://enswitch.example.com/api/json/peers/costs/update/?auth_username=user;auth_password=password;id=2;called_prefix=011

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

Change history

VersionChanges
4.2caller_type parameter added.
4.1least_cost parameter added.
3.15Function added.