Dealing with phone numbers in contact book

If you are building an app that uses the user’s contact book then their certain gotchas to avoid. Telephone country codes are prefix-free If a country has a country code β€œ+91”, then no other country will get a country code like β€œ+912” or β€œ+913”. This scheme ensures that numbers are inherently unambiguous. Telephone numbers can have multiple representations Since most people don’t dial internationally, telecom systems implicitly assume a domestic call. So, someone dialing 612-555-1234 in the US is dialing β€œ+1-612-555-1234”, while the same person in India is dialing β€œ+91-612-555-1234”. Since international dialing would be more infrequent, telecoms require unique prefix numbers like β€œ00” to distinguish whether someone is 612-555-1234 in their country or 0061-255-51234 in Austria. In some states, even the domestic area code is not explicitly required. So, a user might have stored β€œ555-1234” as the phone number to which telecoms will implicitly prefix the user’s area code. And if the user wants to dial beyond their area, the telecom operator would require an additional β€œ0” prefix to mark that it is an STD call. This localization has a massive implication regarding processing cleaning and normalizing phone numbers retrieved from the user’s contact book. Both country code and area code don’t contain β€œ0”, and usually, that’s superfluous. So, while telecoms might be OK with calling or sending SMS to β€œ0-612-555-1234”, they will treat a number like β€œ91-0-612-555-1234” as incorrect. ...