Skip to content

Route and price calls by CLI or CLD

An account has one service plan and one routing group, but each of its Authentication Rules can override both. This tutorial uses that to sell a customer two quality levels on the same trunk, chosen by the caller’s number or by a prefix the customer dials, and to block calls the customer should not send. Allow about 30 minutes.

The example account example-telecom sends calls from 203.0.113.10 and already has a Default service plan and routing group. Calls with a CLI starting with 123 or a CLD starting with 444 should get Premium prices and routes; 456 and 555 get Gold.

  • The account works with its default service plan, routing group and an authentication rule for its IP, as in Set up a wholesale customer.
  • Two more tariff plans, Premium and Gold, with rates for the destinations, and two routing groups with the matching vendors. See Tariffs and Routing groups.
  1. Open My Customers → Accounts, then Actions → Authentication Rules for example-telecom.
  2. Click Add and enter Remote IP Address 203.0.113.10 and Incoming CLI/ANI 123*.
  3. Under Advanced Parameters select Tariff Premium and Routing Group Premium.
  4. Click Save & Close.
  5. Add a second rule with Incoming CLI/ANI 456*, Tariff Gold and Routing Group Gold.
Rule Remote IP Address Incoming CLI/ANI Tariff Routing Group
Existing 203.0.113.10 [From Account] [From Account]
New 203.0.113.10 123* Premium Premium
New 203.0.113.10 456* Gold Gold

A rule with a matching CLI is more specific than the rule with the IP alone, so the switch picks it whenever the CLI matches and falls back to the account’s settings otherwise. Add a CLI Translation Rule such as s/^123// if the prefix must not reach the vendor. See Authentication for how rules are ranked.

Result: three rules for the account; calls are priced and routed by the caller’s number.

  1. Add a rule with Remote IP Address 203.0.113.10 and Incoming CLD/DNIS 444*, Tariff Premium, Routing Group Premium, and CLD Tr. Rule s/^444// to strip the selector before rating and routing.
  2. Add the same with 555*, Gold and s/^555//.

Result: the customer selects the level by dialling 444 or 555 in front of the number.

Two rules that send calls to a number that does not exist in any tariff reject them before routing:

  1. Add a rule with Remote IP Address 203.0.113.10 and CLD Tr. Rule s/^(\d{,9}|\d{11,})$/BLOCK/. Numbers with fewer or more than ten digits become BLOCK, which no rate matches.
  2. Add a rule with Remote IP Address 203.0.113.10, Incoming CLI/ANI anonymous and CLD Tr. Rule s/.*/BLOCK/.

Result: calls with a wrong number length or from an anonymous caller are rejected and cost nothing. For long blocklists use Rules & Lists or a DNC List instead.

  1. Open Tools & Debugs → Test Dialplan and set Mode to Not Authenticated Call with Remote Address 203.0.113.10.
  2. Enter CLI 1235550000 and a CLD; click Proceed. Result shows the matched Authentication Rule, Tariff Premium and Routing Group Premium.
  3. Repeat with CLI 4565550000 for Gold, with a CLD starting with 444 and 555, with an 11-digit CLD and with CLI anonymous.
Screenshot "getting-started/test-dialplan" has not been generated yet — see scripts/screenshots/screens.yml.

Result: each case shows the expected rule, tariff and routing group, and the blocked cases return an error instead of a price.