FA-96501 / Phone number formatting / Open access
Dial string from E.164: domestic calls are dialed without the trunk · case 01
A domestic AA number is dialed without its leading 0.
ROOT CAUSE
The domestic branch returns only the national number.
THE FAILURE
The domestic branch returns only the national number.
Unsuccessful approach: Defaulting to 0 when the caller has no trunk adds a digit for CC callers.
Case contract
Input [canonical +digits, caller country]. Toy table (code, exit prefix, trunk): DD 8/00/-, AA 42/00/0, BB 83/810/8, CC 891/011/-. The input must be "+" and digits only. The destination is the longest matching code. Same code as the caller: dial trunk + national number. Otherwise dial the caller exit prefix + code + national number. Unknown caller or code returns None.
Why this case matters
Click-to-call and PBX integrations dial the string produced here; a wrong prefix connects to a different subscriber or fails.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
e164, frm = x
TABLE = {'DD': ('8', '00', ''), 'AA': ('42', '00', '0'), 'BB': ('83', '810', '8'), 'CC': ('891', '011', '')}
if frm not in TABLE or not e164.startswith('+') or not e164[1:].isdigit():
return None
digits = e164[1:]
cc = max((v[0] for v in TABLE.values() if digits.startswith(v[0])), key=len, default=None)
if cc is None:
return None
nsn = digits[len(cc):]
own_cc, exit_prefix, trunk = TABLE[frm]
if cc == own_cc:
return nsn
return exit_prefix + cc + nsn
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['domestic call adds trunk', ['+42555011123', 'AA'], '0555011123'], ['domestic call without trunk', ['+8915550135', 'CC'], '5550135'], ['caller code is a prefix of destination code', ['+835550121221', 'DD'], '00835550121221'], ['destination code is a prefix of caller code', ['+8555010141', 'BB'], '8108555010141'], ['three-digit exit prefix', ['+8915550135', 'AA'], '008915550135'], ['spaced E.164 rejected', ['+42 555011123', 'AA'], None], ['missing plus rejected', ['42555011123', 'AA'], None], ['leading zero instead of plus rejected', ['042555011123', 'AA'], None], ['unknown caller country', ['+42555011123', 'ZZ'], None]], [['domestic call adds trunk', ['+42555012234', 'AA'], '0555012234'], ['domestic call without trunk', ['+8915550246', 'CC'], '5550246'], ['caller code is a prefix of destination code', ['+835550122332', 'DD'], '00835550122332'], ['destination code is a prefix of caller code', ['+8555010252', 'BB'], '8108555010252'], ['three-digit exit prefix', ['+8915550246', 'AA'], '008915550246'], ['spaced E.164 rejected', ['+42 555012234', 'AA'], None], ['missing plus rejected', ['42555012234', 'AA'], None], ['leading zero instead of plus rejected', ['042555012234', 'AA'], None], ['unknown caller country', ['+42555012234', 'ZZ'], None]], [['domestic call adds trunk', ['+42555013345', 'AA'], '0555013345'], ['domestic call without trunk', ['+8915550357', 'CC'], '5550357'], ['caller code is a prefix of destination code', ['+835550123443', 'DD'], '00835550123443'], ['destination code is a prefix of caller code', ['+8555010363', 'BB'], '8108555010363'], ['three-digit exit prefix', ['+8915550357', 'AA'], '008915550357'], ['spaced E.164 rejected', ['+42 555013345', 'AA'], None], ['missing plus rejected', ['42555013345', 'AA'], None], ['leading zero instead of plus rejected', ['042555013345', 'AA'], None], ['unknown caller country', ['+42555013345', 'ZZ'], None]], [['domestic call adds trunk', ['+42555014456', 'AA'], '0555014456'], ['domestic call without trunk', ['+8915550468', 'CC'], '5550468'], ['caller code is a prefix of destination code', ['+835550124554', 'DD'], '00835550124554'], ['destination code is a prefix of caller code', ['+8555010474', 'BB'], '8108555010474'], ['three-digit exit prefix', ['+8915550468', 'AA'], '008915550468'], ['spaced E.164 rejected', ['+42 555014456', 'AA'], None], ['missing plus rejected', ['42555014456', 'AA'], None], ['leading zero instead of plus rejected', ['042555014456', 'AA'], None], ['unknown caller country', ['+42555014456', 'ZZ'], None]], [['domestic call adds trunk', ['+42555015567', 'AA'], '0555015567'], ['domestic call without trunk', ['+8915550579', 'CC'], '5550579'], ['caller code is a prefix of destination code', ['+835550125665', 'DD'], '00835550125665'], ['destination code is a prefix of caller code', ['+8555010585', 'BB'], '8108555010585'], ['three-digit exit prefix', ['+8915550579', 'AA'], '008915550579'], ['spaced E.164 rejected', ['+42 555015567', 'AA'], None], ['missing plus rejected', ['42555015567', 'AA'], None], ['leading zero instead of plus rejected', ['042555015567', 'AA'], None], ['unknown caller country', ['+42555015567', 'ZZ'], None]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| domestic call adds trunk | 555011123 | 0555011123 | Failed |
| domestic call without trunk | 5550135 | 5550135 | Passed |
| caller code is a prefix of destination code | 00835550121221 | 00835550121221 | Passed |
| destination code is a prefix of caller code | 8108555010141 | 8108555010141 | Passed |
| three-digit exit prefix | 008915550135 | 008915550135 | Passed |
| spaced E.164 rejected | None | None | Passed |
| missing plus rejected | None | None | Passed |
| leading zero instead of plus rejected | None | None | Passed |
| unknown caller country | None | None | Passed |
SHA-256 / 9aaee373360ce513c8eeabacf4a2a00882e9cc4e0071edacb23382ada6e01e23
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
e164, frm = x
TABLE = {'DD': ('8', '00', ''), 'AA': ('42', '00', '0'), 'BB': ('83', '810', '8'), 'CC': ('891', '011', '')}
if frm not in TABLE or not e164.startswith('+') or not e164[1:].isdigit():
return None
digits = e164[1:]
cc = max((v[0] for v in TABLE.values() if digits.startswith(v[0])), key=len, default=None)
if cc is None:
return None
nsn = digits[len(cc):]
own_cc, exit_prefix, trunk = TABLE[frm]
if cc == own_cc:
return (trunk or '0') + nsn
return exit_prefix + cc + nsn
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['domestic call adds trunk', ['+42555011123', 'AA'], '0555011123'], ['domestic call without trunk', ['+8915550135', 'CC'], '5550135'], ['caller code is a prefix of destination code', ['+835550121221', 'DD'], '00835550121221'], ['destination code is a prefix of caller code', ['+8555010141', 'BB'], '8108555010141'], ['three-digit exit prefix', ['+8915550135', 'AA'], '008915550135'], ['spaced E.164 rejected', ['+42 555011123', 'AA'], None], ['missing plus rejected', ['42555011123', 'AA'], None], ['leading zero instead of plus rejected', ['042555011123', 'AA'], None], ['unknown caller country', ['+42555011123', 'ZZ'], None]], [['domestic call adds trunk', ['+42555012234', 'AA'], '0555012234'], ['domestic call without trunk', ['+8915550246', 'CC'], '5550246'], ['caller code is a prefix of destination code', ['+835550122332', 'DD'], '00835550122332'], ['destination code is a prefix of caller code', ['+8555010252', 'BB'], '8108555010252'], ['three-digit exit prefix', ['+8915550246', 'AA'], '008915550246'], ['spaced E.164 rejected', ['+42 555012234', 'AA'], None], ['missing plus rejected', ['42555012234', 'AA'], None], ['leading zero instead of plus rejected', ['042555012234', 'AA'], None], ['unknown caller country', ['+42555012234', 'ZZ'], None]], [['domestic call adds trunk', ['+42555013345', 'AA'], '0555013345'], ['domestic call without trunk', ['+8915550357', 'CC'], '5550357'], ['caller code is a prefix of destination code', ['+835550123443', 'DD'], '00835550123443'], ['destination code is a prefix of caller code', ['+8555010363', 'BB'], '8108555010363'], ['three-digit exit prefix', ['+8915550357', 'AA'], '008915550357'], ['spaced E.164 rejected', ['+42 555013345', 'AA'], None], ['missing plus rejected', ['42555013345', 'AA'], None], ['leading zero instead of plus rejected', ['042555013345', 'AA'], None], ['unknown caller country', ['+42555013345', 'ZZ'], None]], [['domestic call adds trunk', ['+42555014456', 'AA'], '0555014456'], ['domestic call without trunk', ['+8915550468', 'CC'], '5550468'], ['caller code is a prefix of destination code', ['+835550124554', 'DD'], '00835550124554'], ['destination code is a prefix of caller code', ['+8555010474', 'BB'], '8108555010474'], ['three-digit exit prefix', ['+8915550468', 'AA'], '008915550468'], ['spaced E.164 rejected', ['+42 555014456', 'AA'], None], ['missing plus rejected', ['42555014456', 'AA'], None], ['leading zero instead of plus rejected', ['042555014456', 'AA'], None], ['unknown caller country', ['+42555014456', 'ZZ'], None]], [['domestic call adds trunk', ['+42555015567', 'AA'], '0555015567'], ['domestic call without trunk', ['+8915550579', 'CC'], '5550579'], ['caller code is a prefix of destination code', ['+835550125665', 'DD'], '00835550125665'], ['destination code is a prefix of caller code', ['+8555010585', 'BB'], '8108555010585'], ['three-digit exit prefix', ['+8915550579', 'AA'], '008915550579'], ['spaced E.164 rejected', ['+42 555015567', 'AA'], None], ['missing plus rejected', ['42555015567', 'AA'], None], ['leading zero instead of plus rejected', ['042555015567', 'AA'], None], ['unknown caller country', ['+42555015567', 'ZZ'], None]]]
for label, arg, expected in fixtures[N - 1]:
check(label, solve(arg), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| domestic call adds trunk | 0555011123 | 0555011123 | Passed |
| domestic call without trunk | 05550135 | 5550135 | Failed |
| caller code is a prefix of destination code | 00835550121221 | 00835550121221 | Passed |
| destination code is a prefix of caller code | 8108555010141 | 8108555010141 | Passed |
| three-digit exit prefix | 008915550135 | 008915550135 | Passed |
| spaced E.164 rejected | None | None | Passed |
| missing plus rejected | None | None | Passed |
| leading zero instead of plus rejected | None | None | Passed |
| unknown caller country | None | None | Passed |
SHA-256 / 5b5e52a74b9544212c9c490215c15d0aed734864dfd9fc7c86576d10ecf8dc17
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 9 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗Verification & scope
A deterministic toy contract over synthetic, obviously fictitious telephone numbers and toy country tables. The rules are stipulated for this model only and make no claim of conformance with any numbering plan or telecommunications standard. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:52:23.488569+00:00.
Case digest / bf9d2baafe9fdc66a4e66fd226d0b4fd04ca5df352c6fcae571ea55f9fc13dae