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.
| Received | What it is | Rule to normalise | Result |
|---|---|---|---|
+99971234567 | E.164 with plus | Remove + | 99971234567 |
0099971234567 | International access code 00 | Strip leading 00 | 99971234567 |
01199971234567 | International access code 011 (North American style) | Strip leading 011 | 99971234567 |
777#99971234567 | Customer tech prefix 777# | Strip 777# | 99971234567 |
99971234567 | Already clean | None | 99971234567 |
071234567 | National format with trunk prefix 0 | Reject, or replace 0 with 999 only if this customer is known to be in Country Z | 99971234567 |
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:
- Strip N digits or a fixed string: remove
00, a tech prefix, or a+. - Add (prepend) a string: put a vendor tech prefix such as
1234#in front. - Replace one prefix with another:
0→999, or999→00999for a vendor that wants access codes. - Match conditions: apply a rule only when the number starts with a given prefix or has a given length.
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
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:
| Prefix | Destination | Expected total length |
|---|---|---|
999 | Country Z – fixed (all other ranges) | 10–11 digits |
9997 | Country Z – mobile | 11 digits |
99970 | Country Z – mobile, Operator A | 11 digits |
99990 | Country Z – premium / special services | varies – 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:
- National format (
0712…) – the destination network may not recognise it as international and show garbage or drop the call. Convert to E.164 only when you know the caller’s country. - Tech prefix or text in the CLI – strip it, or reject.
- Too short, too long or all zeros – usually invalid; many routes and regulators reject such calls.
- Anonymous – keep the privacy request, but the real identity may still need to travel in P-Asserted-Identity where rules require it.
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
- Prepare a test list of numbers in every format a customer might send, including bad ones.
- For each, write down the number you expect after inbound rules, the destination it should match, and what the vendor should receive.
- 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.
- Repeat for the CLI: confirm what the far end displays.
- 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.
Related reading
- Lesson 4: VOS3000 accounts, gateways, prefixes and rate groups
- CLI vs NCLI routes explained for wholesale VoIP buyers (blog)
- VoxInspector – VoIP monitoring, FAS detection and route testing for VOS3000
- All training lessons · VoxComms home
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.