Skip to content

Rate Deck Management

1. Rate Deck Types

TypePurpose
Buy DeckCarrier cost price, associated with trunks
Sell DeckCustomer sales price, associated with tenants

Wholesale rate decks console

2. Create a Rate Deck

Wholesale → Rate Decks → Create New:

  • Name: e.g. “buy-carrier-a-cn”
  • Type: Buy/Sell
  • Description: Remarks

3. Rate Entries

Each rate deck contains multiple rate entries:

FieldDescriptionExample
PrefixNumber prefix (longest match)8610
RatePrice per minute0.03
Min DurationMinimum billable seconds6
Billing IncrementBilling unit in seconds6

Billing Formula

CDR Duration = max(actual talk time, min duration)
Billable Duration = ceil(CDR Duration / billing increment) × billing increment
Cost = Billable Duration / 60 × Rate

Example: Rate 0.03 per minute, min 6 seconds, increment 6 seconds

  • 4 seconds talk → billed 6 seconds → 0.003
  • 15 seconds talk → billed 18 seconds → 0.009
  • 60 seconds talk → billed 60 seconds → 0.03

Prefix Matching Rules

Uses Trie longest prefix match:

  • Number 861012345678 matches both 86 (0.05) and 8610 (0.03) — 8610 is selected
  • Calls with no matching prefix are rejected

4. CSV Bulk Import

Rate Deck Details → Import → Upload CSV

CSV format:

prefix,rate,min_duration,increment
86,0.05,6,6
8610,0.03,6,6
8613,0.04,6,6
1,0.08,6,6
44,0.06,1,1
ColumnRequiredDescription
prefixYesNumber prefix
rateYesRate per minute
min_durationNoMinimum duration, defaults to 6
incrementNoBilling increment, defaults to 6

Import behavior worth knowing:

  • Idempotent upsert — re-importing the same prefix updates its rate instead of duplicating the row, so a corrected CSV is a safe re-run.
  • Prefix is the key — that also means a typo’d prefix creates a new entry rather than failing; sanity-check the imported count against the file’s row count.
  • Mixed granularity is fine — decks routinely carry per-second (1,1) entries for premium destinations and per-6-second entries for bulk ones.
  • Preview before commit — large imports show the parsed rows for review; nothing is written until you confirm.

5. Hot Reload

After modifying a rate deck, click the “Reload” button:

  1. The system exports from the database to rate_decks.generated.toml
  2. Rebuilds the in-memory Prefix Trie
  3. New calls use the updated rates; existing calls are unaffected

6. Diagnostic Tools

Tenant Details → Price Calculator:

  • Enter the callee number
  • The system displays the matched prefix, sell rate, routing trunk, buy rate, and expected profit
  • Useful for verifying rate configuration

© 2026 Miuda.ai · Contact · GitHub Issues

    ↑ ↓ navigate↵ open