Background job to manage ratedeck DB.

Note

Only super admin can use this module.

Rates are stored in a database named after the ratedeck_id attribute. This defaults to ratedeck if not supplied.

An account can be assigned a ratedeck; if no ratedeck is assigned, the default ratedeck database is used. The account will be queried first, then the reseller, before selecting the default ratedeck.

## Fields#

Name Description Required
account_id reseller's account (see first below)
description description for rate
direction direction of call leg ("inbound", "outbound"), if not set - rate matches both directions
iso_country_code ISO 3166-1 code for prefix's country
prefix prefix for match DID number true
pvt_rate_cost internal rate cost, used for weight calculation
pvt_rate_surcharge internal rate surcharge
rate_cost per minute cost true
rate_increment billing "steps" for rate
rate_minimum minimum call duration
rate_name short name for rate, if this field not set it will be generated from prefix, iso_country_code and direction fields
rate_nocharge_time "free" call time, if call duration less then this value (seconds), then call not charged
rate_surcharge charge amount on connect (answer)
rate_version rate version
ratedeck_id ratedeck name, assigned to account via service plan
weight when found several rates with same prefix, used rate with higher weight. If not set - calculated from prefix length and rate_cost (pvt_rate_cost)
caller_id_numbers string of caller id prefixes separated by ":". For ex.: 441:442:443 It will be converted into ["^\+?441.+$", "^\\+?442.+$", "^\+?443.+$"] routes string of either a single route "\+?44.+$" or a json array string '["^\\\\+?123$","\\+?456$"]'

CSV files for all actions use the same list of fields. Names of fields match the names of keys in the CouchDB rate document.

Note

For import and delete actions, value of account_id from CSV file will be ignored, value for this field is taken from task Account-ID .

Note

options field can not be defined via CSV file (because its values are lists).



### Delete#

Delete rates for prefixes in CSV file. prefix is a mandatory field.

The rate will be deleted only if all defined fields in CSV file match the appropriate keys in rate document. An undefined field in CSV file means "match any".