FreeCalypso > hg > themwi-docs
comparison NANP-specifics @ 0:6da76097c86e
initial import from old themwi-system-sw repository
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Mon, 25 Dec 2023 07:41:31 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:6da76097c86e |
|---|---|
| 1 North American Numbering Plan (NANP) specifics in ThemWi system sw | |
| 2 ================================================================== | |
| 3 | |
| 4 Themyscira Wireless system software, as currently written, is strongly tied to | |
| 5 NANP. More precisely, it thoroughly assumes that all local phone numbers are | |
| 6 in +1 country code and follow NANP rules, and that all E.164 telephone numbers | |
| 7 in country codes other than +1 are foreign - numbers which we can call and | |
| 8 receive calls from, but which can never be local to us. | |
| 9 | |
| 10 Why does our software need to have these assumptions baked into it, why can't | |
| 11 it be country-agnostic? The present article answers this question, and this | |
| 12 long answer needs to be thoroughly understood before there can be any meaningful | |
| 13 discussion of how the software could possibly be adapted to other countries and | |
| 14 their respective telephone numbering plans. | |
| 15 | |
| 16 In principle, there exists a standardized dialing format on all GSM phones that | |
| 17 remains the same no matter which country you happen to be in. If you always | |
| 18 enter phone numbers (dialing, SMS manual entry, phone book entries) in full | |
| 19 international format beginning with the '+' symbol (press and hold the '0' | |
| 20 button before the number in most phone UIs), the phone handset firmware will | |
| 21 capture the number with TON=1, NPI=1 attributes (signifying international number | |
| 22 format in GSM call control and SMS protocols) and transmit it as such to the | |
| 23 GSM network. Every properly designed GSM network, upon seeing a number with | |
| 24 these TON=1, NPI=1 attributes, must address the call or message to the country | |
| 25 indicated by the country code at the beginning of the full E.164 number, whether | |
| 26 that country is your local one or some other. Thus if everyone were to always | |
| 27 use only full E.164 numbers in full international format, network software could | |
| 28 hypothetically be written in a country-agnostic way, treating full E.164 phone | |
| 29 numbers as opaque strings without parsing. However, there are two practical | |
| 30 problems with such country-agnostic approach: | |
| 31 | |
| 32 1) Most human users of mobile phones dial local phone numbers (within their own | |
| 33 country) in a way that follows local dialing conventions, rather than in | |
| 34 international format beginning with '+' and their own country code. For | |
| 35 example, in USA a given 10-digit NANP phone number can be dialed as just the | |
| 36 10 digits NPANXXXXXX, as 11-digit 1NPANXXXXXX, or as full international | |
| 37 +1NPANXXXXXX - and a proper cellphone network MUST accept all 3 formats as | |
| 38 equivalent. | |
| 39 | |
| 40 2) As explained further in this article, a network implementation must be able | |
| 41 to look at a telephone number and immediately tell if that number is locally | |
| 42 owned ("one of ours") or belongs somewhere outside of the local GSM network. | |
| 43 Practical implementation of this distinction requires a database of locally | |
| 44 owned phone numbers, and the implementation of that database in turn becomes | |
| 45 much easier when the local numbering plan is known and fixed. | |
| 46 | |
| 47 Supported dialing formats in ThemWi | |
| 48 =================================== | |
| 49 | |
| 50 When themwi-mncc processes a mobile-originated (MO) call from a GSM subscriber, | |
| 51 it supports dialing the following classes of numbers: | |
| 52 | |
| 53 * NANP numbers in any of the 3 standard dialing formats; | |
| 54 | |
| 55 * International numbers in any country - an international number beginning | |
| 56 with +1 is enforced to be valid NANP, but E.164 numbers in all other country | |
| 57 codes are accepted as-is; | |
| 58 | |
| 59 * Local 4-digit numbers described in Local-short-numbers article; | |
| 60 | |
| 61 * Whatever special numbers are configured in themwi-sip-out, such as 511 and | |
| 62 911. | |
| 63 | |
| 64 Only NANP numbers and specially configured 4-digit numbers (see | |
| 65 Local-short-numbers) can be local - all E.164 numbers in non-NANP country codes | |
| 66 are sent to the outbound call gateway, and all other unrecognized number formats | |
| 67 are likewise sent to themwi-sip-out so that the latter process can catch and map | |
| 68 special numbers like 511, 911 etc. | |
| 69 | |
| 70 If a dialed number is recognized as NANP, themwi-mncc looks in the database of | |
| 71 locally owned numbers to see if the dialed number is one of ours - and the | |
| 72 outcome of this look-up determines if the call is handled locally or sent to | |
| 73 the outside world via themwi-sip-out. | |
| 74 | |
| 75 No 7-digit dialing support | |
| 76 ========================== | |
| 77 | |
| 78 In the olden days of land lines, most localities in USA supported 7-digit | |
| 79 dialing: to call Jenny, you would merely dial her local 7-digit number 867-5309, | |
| 80 without needing to dial the local area code; full 10-digit numbers (or 11 digits | |
| 81 with leading '1') had to be dialed only when calling someone in a different | |
| 82 area code from your own. However, this 7-digit dialing has now been disabled | |
| 83 even for land lines in most localities, including the locality where ThemWi | |
| 84 currently operates: per official rules, 7-digit dialing gets disabled (full | |
| 85 10-digit numbers become mandatory) whenever an area code overlay is implemented, | |
| 86 such as overlay of 760 and 442 area codes in our locality. | |
| 87 | |
| 88 In the case of mobile phones, 7-digit dialing never made much sense to begin | |
| 89 with: if you dial only 7 digits, should the implicit area code be taken from | |
| 90 your own number, or should it be the area code of the locality you happen to be | |
| 91 traveling through at the moment? The latter option is impossible in the case | |
| 92 of localities with two or more overlaid NPA codes, and it appears that official | |
| 93 rules once again call for simply disabling 7-digit dialing. | |
| 94 | |
| 95 Based on these considerations, ThemWi system sw was written from the outset to | |
| 96 not support 7-digit dialing - it is no longer relevant in the current state of | |
| 97 telecom culture in USA. We do, however. provide optional support for | |
| 98 abbreviated 4-digit local numbers - see Local-short-numbers article. | |
| 99 | |
| 100 Database of locally owned numbers | |
| 101 ================================= | |
| 102 | |
| 103 The telecom culture in USA features full number portability - end users can take | |
| 104 their phone numbers with them anywhere, from one telecom provider to another, | |
| 105 and with mobile phones and VoIP services, from one geographic locality to any | |
| 106 other, making the entire country effectively "flat" for local/non-local | |
| 107 distinction purposes. Therefore, the set of phone numbers "owned" (or rented | |
| 108 in reality) by a small network operator such as Themyscira Wireless does not | |
| 109 constitute any kind of clean-cut digit range partition in the numbering plan - | |
| 110 instead we can have a small set of locally owned numbers (say, on the order of | |
| 111 5 to 20 individual numbers), and each of these locally owned numbers can fall | |
| 112 anywhere in the whole nationwide 10-digit numbering plan. So how can we tell, | |
| 113 by looking at an arbitrary NANP number, whether it is "one of ours" or not? | |
| 114 | |
| 115 The implemented solution is an explicitly maintained database of locally owned | |
| 116 phone numbers, described in detail in Number-database article. The format of | |
| 117 this database (the way numbers are entered, the way the input format is parsed, | |
| 118 and the compiled binary format used for fast look-ups) is specific to NANP - | |
| 119 only NANP numbers can be local in the present design. | |
| 120 | |
| 121 Porting to other national telephone numbering plans | |
| 122 =================================================== | |
| 123 | |
| 124 If someone wishes to port ThemWi system sw for use in other countries with | |
| 125 respective local phone numbers, the following aspects will need to be changed: | |
| 126 | |
| 127 * Based on the structure of your country's national numbering plan, you will | |
| 128 need to come up with an appropriate local number database format for your | |
| 129 country, or if the range of numbers belonging to your GSM network forms a | |
| 130 clean-cut digit range partition, implement that scheme instead. | |
| 131 | |
| 132 * You will need to modify MO call handling to recognize your country code | |
| 133 (rather than +1) as the one calling for parsing and closer scrutiny of the | |
| 134 dialed number, determining if it is local or not. | |
| 135 | |
| 136 * Handling of non-international dialing formats (numbers dialed without '+') | |
| 137 will need to be changed to whatever is appropriate for your country's telecom | |
| 138 culture and customs. | |
| 139 | |
| 140 * Handle all secondary fallout (throughout the code base) from the previous | |
| 141 essential and necessary changes. | |
| 142 | |
| 143 Using fake NANP numbers | |
| 144 ======================= | |
| 145 | |
| 146 If someone outside of North America wishes to merely play with ThemWi system sw | |
| 147 on a casual basis, without actually interconnecting to your non-USA PSTN with | |
| 148 non-NANP real phone numbers, the easiest way to bring the software up is to use | |
| 149 fake NANP numbers. There are two types of guaranteed-fake (can't collide with | |
| 150 real ones) phone numbers in NANP: | |
| 151 | |
| 152 1) NPA-555-01XX, where NPA is some real area code for some (any) actual locality | |
| 153 in USA and XX can be any two digits. This number range is specifically set | |
| 154 aside for use in movies etc, with realistic USA settings - the area code can | |
| 155 be any real one, but 555-01XX numbers are reserved for fake use in every | |
| 156 area code. | |
| 157 | |
| 158 2) Fake area codes of form N9X (290-299, 390-399, ..., 990-999) are also good | |
| 159 for guaranteed-fake numbers as the middle digit of NPA is not allowed to be | |
| 160 '9' per official NANP rules. This method allows large ranges of fake NANP | |
| 161 numbers. | |
| 162 | |
| 163 See Fake-NANP-numbers article for more info. |
