Country codes, including city codes

I am trying to create a table full of country code codes, so I can match phone numbers and get their country of origin.

I know http://blog.attigohk.com/2010/12/12/countriesdb-free-country-code-sql-database/ and especially http://www.itu.int/ which contains the "official" list.

But I'm fixated on getting area codes, as Canada and the US share +1, so there’s no good definition of a number with only +1.

Can someone help me in the right direction, so can all worlds phone numbers be identified?

+4
source share
3 answers

I would use Wikipedia listings here . For +1, you will have to use more numbers to identify the country, as it is also shared by different Caribbean countries. This other Wikipedia article splits it on here .

It may also be useful to have a list of international prefixes (that is, numbers used to indicate that you are dialing a number internationally). This list is here . This may be convenient in some environments where you cannot be sure which format of telephone number is provided to you. For example, some mobile operators will send usage records with a number dialed by the client, for example, β€œ+441234567890”, because it will automatically be converted to β€œ0011441234567890”, but some customers will dial this full number, so you need to know which numbers to ignore.

+2
source

The United States and Canada share +1, but the region codes are different and do not overlap. If you want to determine the phone number, simply select a country based on the country identifier and the first area code numbers. Thus, you will receive the correct country (and city code) even for us and Canada.

0
source

A database for Area Codes can be downloaded from here (MS access format)

0
source

Source: https://habr.com/ru/post/1393512/


All Articles