Home / Training / Lesson 13
VoIP Training · Lesson 13 of 15

Number formats and dial plans: E.164, prefix manipulation and CLI formats

The international number format, the variations customers send, and how to clean called and calling numbers on the way in and format them for each vendor.

By VoxComms · · 5 min read

A surprising share of failed calls, wrong charges and CLI complaints come down to one thing: a number written in a format the next system did not expect. This lesson explains the international number format every carrier should work in, the variations customers actually send, and how to build a dial plan that cleans up called and calling numbers on the way in and formats them for each vendor on the way out. Country Z, code 999, is invented, and so are all the numbers.

E.164: one format to rule them all

E.164 is the ITU-T standard for international telephone numbers. A complete E.164 number is:

Country code (1–3 digits) + national significant number — maximum 15 digits, no spaces, no leading zeros

+999  7  1234567
 |    |  └─ subscriber number
 |    └──── national destination code (7 = mobile in Country Z)
 └───────── country code 999

Written for display, a + goes in front. Inside most wholesale switches the plus is dropped and the number is simply 99971234567. Choose one internal convention and use it everywhere: rate decks, routing prefixes, CDR searches and reports. This course assumes digits only, no plus, no leading zeros.

The formats customers really send

The same subscriber can reach your switch in several shapes. Each needs a different rule to become the clean internal form.

ReceivedWhat it isRule to normaliseResult
+99971234567E.164 with plusRemove +99971234567
0099971234567International access code 00Strip leading 0099971234567
01199971234567International access code 011 (North American style)Strip leading 01199971234567
777#99971234567Customer tech prefix 777#Strip 777#99971234567
99971234567Already cleanNone99971234567
071234567National format with trunk prefix 0Reject, or replace 0 with 999 only if this customer is known to be in Country Z99971234567

The last row is the dangerous one. A national number has no country code, so the switch cannot know which country it belongs to. Only convert it when the agreement says so; otherwise reject it with a clear code such as 484 or 404 and ask the customer to send international format.

The building blocks of number manipulation

Every softswitch names these differently, but they come down to a few operations, applied to the start of the number:

Order matters. If a rule adds 999 to numbers starting with 0, and another strips 00, a number like 00999… must hit the strip rule first. Write the rules down in the order the switch applies them and test each one with a sample number.

Where each rule belongs

Customer Y sends777#0099971234567 Inbound rulesstrip 777#, strip 00 Rate + route99971234567longest prefix 9997 To Vendor X1234#99971234567 Clean in the middle, partner-specific only at the edges.
Normalise on the mapping (customer) side; format for the vendor on the routing side.

The golden rule: everything in the middle of the switch sees clean E.164 digits. Customer quirks are removed on the customer side; vendor requirements are added on the vendor side. Then one rate deck and one set of routing prefixes work for every partner, and a CDR search for 9997 finds every Country Z mobile call, whoever sent it.

Dial plans and prefix matching

Once numbers are clean, rating and routing choose a destination by the longest matching prefix (see Lesson 5). A dial plan for Country Z might look like this:

PrefixDestinationExpected total length
999Country Z – fixed (all other ranges)10–11 digits
9997Country Z – mobile11 digits
99970Country Z – mobile, Operator A11 digits
99990Country Z – premium / special servicesvaries – often blocked

Adding length checks catches broken numbers early. A Country Z mobile number shorter than 11 digits cannot be valid; rejecting it at once with 484 Address Incomplete is cheaper and clearer than sending it to three vendors and collecting three failures. Also block or restrict premium and special-service ranges unless a customer has a real need; they are a favourite target for fraud.

Calling numbers (CLI) need rules too

The caller ID travels in the SIP From header and often also in P-Asserted-Identity (the network’s trusted identity), with a Privacy header when the caller asked to hide it. Typical inbound CLI problems:

Outbound, each vendor may want a slightly different CLI format: with or without +, with 00, or in national form for domestic routes. Configure this per routing gateway, never by editing the number in the middle of the switch. CLI routes must pass the caller ID unchanged in meaning; changing it is a business and often a regulatory decision (see Lesson 7).

Testing a dial plan

  1. Prepare a test list of numbers in every format a customer might send, including bad ones.
  2. For each, write down the number you expect after inbound rules, the destination it should match, and what the vendor should receive.
  3. Place test calls, or use the switch’s route-test tool if it has one, and compare the CDR’s called number and matched prefix with your expectation.
  4. Repeat for the CLI: confirm what the far end displays.
  5. Keep the list; rerun it after any change to number rules.

Key takeaways

  • E.164 is country code plus national number, up to 15 digits; use one clean internal form everywhere.
  • Strip +, 00, 011 and customer tech prefixes on the way in; add vendor formats on the way out.
  • Never guess the country of a national-format number – convert only when the agreement says so.
  • Longest-prefix matching plus length checks catches broken numbers early.
  • Calling numbers need the same discipline: clean on the way in, formatted per vendor on the way out.

Quick quiz

1. A customer sends 777#0099971234567. What should the switch see after inbound rules?

99971234567 – the tech prefix and the 00 access code are both stripped.

2. What is the maximum length of an E.164 number?

15 digits, including the country code.

3. Why add vendor tech prefixes on the routing gateway rather than in the rate deck?

So the middle of the switch always works with clean numbers and one deck and prefix list serves every partner.

Examples in this course use invented names (Vendor X, Customer Y, Country Z) and documentation IP ranges. Menu names and options differ between softswitch versions; always check your own system and vendor documentation.