(Read part 1 of this series)
I've decided to put off the promised discussion of phone number formatting in order to instead discuss in greater detail the components of a telephone number.
I'm sure this will be rather boring to most readers. In fact, I find it a bit so myself. However, I think it's important to be precise.
On the “international plane”, a phone number consists of two or perhaps three parts. E.164 defines these parts, and I'll explain them.
All fully qualified phone numbers have a country code (one to three digits written with a plus sign in front, such as “+1” or “+972” or “+86”). Simple enough. Country codes uniquely identify the single country where the call should be routed, except when they don't. The country code +1 is shared among the 24 countries in North America and the Caribbean, and the country code +7 is shared between Russia and Kazakhstan. Other shared country codes include +262, +290, and +358.
The second part is the “national destination number”, also known as the city code. In the phone number “+1 (206) 323-0020”, the city code is 206. All NANP city codes (normally called area codes) are 3 digits long. In a phone number such as “+44 20 7481 8595”, the city code is “20” for London. The UK's city codes range from short (20) to long (176 83).
Nongeographic area codes, such as the common toll-free “800” and variants, are also national destination codes.
Some countries don't have city codes. All phone numbers in Estonia, for example, are fully nongeographic.
The third part of the phone number (still viewed solely from the international plane) is the subscriber number. This is allocated in a way that is entirely up to the nation and its telephone company. From an international perspective, assignment procedures for this numbering space are completely opaque.
Let's drop down a level, to the “national plane”. Here things get much more varied and interesting.
In the United States, 3-digit area codes are assigned to a city-sized region. The next level of assignment is a 3-digit “exchange code”. In the number “+1 (812) 232-1715”, the area code is “812” and the exchange code is “232”. Typically each exchange code corresponds to a particular piece of switching equipment that provides telephone service to up to 10,000 subscribers. In the past 15 years, however, telephone companies have been allocated numbering blocks that are 4 digits long, called “thousands blocks” because they contain one thousand phone numbers. In this example, the thousands block would be “232-1”. These assignments are managed by the North American Number Plan Administration. The NANP structure has stayed substantially the same since it was created in 1951 to allow direct distance dialling (DDD).
The US has fixed-length phone numbers with fixed-length area codes and exchange codes. Are there any countries with varying length area codes? I'm glad you asked!
In the United Kingdom, area codes vary in length from two to six digits, but the total length of the national number (area code and subscriber number together) is fixed at 10 digits in almost all cases. Assignments are handled by Ofcom. Number blocks assigned in the UK also vary in length. Due to a lack of foresight, area codes in the UK have been changed multiple times since direct distance dialling (Subscriber Trunk Dialling, STD) was introduced in 1958.
So far we've looked at two countries whose phone numbers are all the same length. Is it common for phone numbers to vary in length within a country?
Yes! It's common, for example, for mobile numbers to be one or two digits longer than fixed-line numbers. Germany, however, is an extreme example of this.
In Germany, area codes can be from two to five digits long. The numbers within those area codes also vary in length, but the two are not required to add up to any particular length. Subscriber numbers can be as short as three digits in rural areas, or as long as eight digits in dense urban areas. Digits dialed after the subscriber number are also passed on to the subscriber's ISDN telephone, allowing for direct dialling of extensions as if they are a normal telephone number.
This structure comes from the history of Germany's telephone network. They used to use Step-By-Step telephone switchgear, which is much more conducive to variable-length numbers than any other type. It also requires much more discipline to set up properly than any other type of mechanical switchgear. Step systems were used in almost every country, but Germany had the largest single deployment.