I’m only throwing my opinion in rather than something more useful (like
real life implementation) but there have been previous discussions about
delivery addresses which overlap with this question. That discussion
culminated in the general principal that the user knows best what
address is going to get through to them and unless you are genuinely
doing some sort of machine parsing (and most people aren’t) you should
use a free format text field and let the user enter the information in
whatever format they prefer.
I would apply the same logic to phone numbers. Personally I prefer to
enter phone numbers as:
+61 417 123 456
…because + is the international dial prefix, 61 is Australia and 417
123456 is the phone number. dialling that number in Australia I would
enter 0417 123456.
Having said that a user might enter:
00 11 61 417 123456
…which is the Australian international dial prefix (0011) and that
would less useful- in the U.S. the same thing would be 011 61 417
123456. So users can certainly enter unhelpful information. I would
certainly capture the country of the user separately to the phone so you
could cross check in case they enter a local phone number.
The most important thing is to be clear what you are asking for- you
want the International dial code for the country (61 for Australia, 1
for the US) but not International dial prefix for your provider (which
could be 0011, 011 or lots of other things).
Also, users often format the number for ease of (human) use. So:
+61 417 417 417
+61 417 55 66 77
+612 216 612 0
These number are formatted in a human readable/usable way which is
information that would be nice to preserve.
I fall back on the general principle that the user knows what is going
to get through to them and you should be be generous in what you accept.
If you later need to machine parse it, make the computer do the hard
work, not the user.