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.
| Name | Type | Description | Required | Default value |
|---|---|---|---|---|
| auth_username | String | Authentication username. | Yes | |
| auth_password | String | Authentication password. | Yes | |
| peer | Integer | ID of peer. | Yes | |
| called_max | Integer | Maximum length of called number to match. | No | 100 |
| called_min | Integer | Minimum length of called number to match. | No | 1 |
| called_prefix | String | Called prefix to match. Empty string for any. | No | Empty string. |
| caller_type | String | Callerid type: prefix or group. | No | prefix |
| caller_prefix | String | Callerid prefix or group to match. Empty string for any. | No | Empty string. |
| connectfee | Decimal | A connect fee charged on answer. | No | 0.00 |
| cost | Decimal | The cost per minute after the included seconds are used. | No | 0.00 |
| days | String | Days time chunk is active. Monday = 1, Sunday = 7. For example, "12345" for Monday to Friday. | No | "1234567" |
| description | String | Description. | No | Empty string. |
| end | Integer | The Unix timestamp after which this cost no longer applies. -1 for never. | No | -1 |
| endhour | Integer | End hour from 0 to 23. | No | 23 |
| endminute | Integer | End minute from 0 to 59. | No | 59 |
| included | Integer | The number of seconds included free with the connectfee. | No | 0 |
| increment | Integer | Billing increment in seconds. | No | 1 |
| least_cost | Integer | 1 to use this cost for least cost routing, 0 not to. | No | 1 |
| media | String | Media type. "fax", "voice", or "voice_fax". | No | "voice_fax" |
| message | Decimal | The cost to send a message. | No | 0.00 |
| minimum | Decimal | An overall minimum cost for the call if answered. | No | 0.00 |
| priority | Integer | The priority from 1 to 10. | No | 1 |
| start | Integer | The Unix timestamp from which this cost applies. | No | -1 |
| starthour | Integer | Start hour from 0 to 23. | No | 0 |
| startminute | Integer | Start minute from 0 to 59. | No | 0 |
| 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. |
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
| Version | Changes |
|---|---|
| 4.2 | caller_type parameter added. |
| 4.1 | least_cost parameter added. |
| 3.15 | Function added. |
