Limit a minute plan to destinations
A minute plan sells a bundle of minutes for a fixed price per billing period, for example 1000 minutes to UK landlines. Its destination patterns decide which calls draw on the bundle; every other call is charged by the tariff as usual. This tutorial writes patterns for UK landlines and other non-mobile numbers, uploads them to a tariff plan and checks the result. Allow about 15 minutes.
Before you start
Section titled “Before you start”- You have a tariff plan with rates for the destinations, and an account that uses it. See Tariffs.
- The account’s customer is set up for periodic billing, so the plan’s price is charged each period. See Service plans.
Step 1: Write the patterns
Section titled “Step 1: Write the patterns”Patterns are prefixes of the called number in the switch’s internal format, after the translation rules of the account. Each pattern is either included or excluded:
- An included prefix puts numbers that start with it into the plan.
- An excluded prefix takes numbers that start with it out of the plan.
- A
.(dot) in a prefix matches any one digit.
When a number matches several prefixes, the longest one decides. An excluded prefix wins over an included prefix of the same length, and an excluded prefix equal to the whole number always wins.
| Included | Excluded | In the plan | Not in the plan |
|---|---|---|---|
111 |
1114 |
11155555, 1110000000 |
111456, 11147777, 55555 |
111, 11141 |
1114 |
111222, 11141222 |
1114222 |
111.2 |
111222, 11142555 |
11133333 |
In the second row 11141222 is in the plan because the included 11141 is longer than the excluded 1114.
For all UK numbers except mobiles and premium-rate numbers, include 44 and exclude 447, 4487 and 449:
| Included Prefixes | Excluded Prefixes |
|---|---|
44 |
447 |
4487 |
|
449 |
Result: two columns of prefixes for the plan.
Step 2: Prepare the file
Section titled “Step 2: Prepare the file”- Open Tariffs & Currencies → Tariff Plans and open the tariff plan.
- Open the Add-ons tab and scroll to Minute Plans.
- In the empty row click Get Template under Destinations Patterns. The file has the columns Included Prefixes and Excluded Prefixes.
- Enter your prefixes below the header row, one per cell, and save the file as CSV or XLSX. The first line is always skipped as the header.
Result: a file with your patterns.
Step 3: Add the minute plan
Section titled “Step 3: Add the minute plan”- In the empty row of Minute Plans enter Minute Plan Name:
UK landlines 1000. - Enter Included Minutes:
1000. Leave it empty for unlimited minutes. - Enter Price for the bundle per billing period, and Interval 1 and Interval N in seconds for the billing increments of calls in the plan.
- Click Import from… under Destinations Patterns and select your file.
- Click Add Row.
Result: the row shows Included prefixes: 1, Excluded prefixes: 3.
Step 4: Test it
Section titled “Step 4: Test it”- Open Tools & Debugs → Test Dialplan.
- Select Mode Authenticated Call and type the name of the account that uses the plan.
- Enter CLD (destination)
442079460123and click Proceed. The result shows Minute PlanUK landlines 1000and Minutes Left. - Repeat with the mobile number
447700900123. No minute plan is shown; the call is charged at the tariff’s rate.
Result: calls to UK landlines draw on the bundle, calls to mobiles and premium-rate numbers do not.
What’s next
Section titled “What’s next”- Service plans: billing periods, service charges and minute plans.
- Rating and billing: how a call is charged when it is outside the plan.
- Match a number with account minute plans: the same check through the API.