If I have a contact in my iPhone address book of the form XXX-YYYY and tap it to dial it then the iPhone dials the number 206-XXX-YYYY (206 is the area code for Seattle, US, which is where the phone doing the dialing and the phone being dialed both are).
I have an app which goes through a user's Contact's app extracting the phone numbers and I would like to be able to detect when an area code is missing like this and to add it in the same was as iOS itself is doing.
Does anybody have any idea how I could do this?
I know the iPhone's phone number, which will be for example AAA-BBB-CCCC, so I could compare AAA-BBB-CCCC with the phone numbers in the address book and if I see a number like XXX-YYYY then I could deduce a) that the area code is missing and b) that the missing area code must be the same as the iPhone's area code and so prepend AAA to XXX-YYYY.
I know that's going to be too simplistic a solution, and might only work in North America.
So how is the iPhone doing it, and is there a scalable solution that will work for all countries?
I'm aware of libPhoneNumber (and an iOS port of it https://github.com/iziz/libPhoneNumber-iOS) but looking through its API I can't see anything that will firstly detect if an area code is missing from a phone number. Maybe its there, but the iOS libPhoneNumber port isn't extensively documented.
Anybody faced and solved a similar issue to this?