|
|
|
@ -106,8 +106,8 @@ call or send an SMS to. |
|
|
|
M2M numbers would violate this assumption and we'd have to evaluate the |
|
|
|
consequences for existing APIs and clients if M2M numbers would be considered |
|
|
|
valid by the library. Clients of libphonenumber expect `mobile` and `fixed-line` |
|
|
|
numbers to have certain affordances, such as: Reachable for voice calls |
|
|
|
(and for mobile also SMS) as well as assuming standard cost. This expectation |
|
|
|
numbers to have certain affordances, such as: Reachable for voice calls |
|
|
|
(and for mobile also SMS) as well as assuming standard cost. This expectation |
|
|
|
is broken by the lack of M2M standardization today. |
|
|
|
|
|
|
|
Many people use this library for formatting the numbers of their contacts, for |
|
|
|
@ -211,28 +211,51 @@ to achieve this, please do so. Thanks! |
|
|
|
### Why is this number from Argentina (AR) or Mexico (MX) not identified as the right number type? |
|
|
|
|
|
|
|
Certain countries' mobile and/or fixed line ranges may overlap, which may make |
|
|
|
accurate identification impossible without additional and explicit context |
|
|
|
such as a mobile prefix. We rely on this prefix being present to correctly identify |
|
|
|
the phone number type (rather than returning ['FIXED_LINE_OR_MOBILE'](#fixed_line_or_mobile) |
|
|
|
in ambiguous cases) until our metadata can be fine-grained enough to detect when a user has omitted it. |
|
|
|
accurate identification impossible without additional and explicit context such |
|
|
|
as a mobile prefix. We rely on this prefix being present to correctly identify |
|
|
|
the phone number type (rather than returning |
|
|
|
[`FIXED_LINE_OR_MOBILE`](#fixed_line_or_mobile) in ambiguous cases) until our |
|
|
|
metadata can be fine-grained enough to detect when a user has omitted it. |
|
|
|
|
|
|
|
For example, when calling a mobile line from a fixed line in Argentina, |
|
|
|
you need to dial 15 before the subscriber number, or 9 if you're calling |
|
|
|
from another country. Without these additional digits, your call may not |
|
|
|
connect at all! |
|
|
|
For example, when calling a mobile line from a fixed line in Argentina, you need |
|
|
|
to dial 15 before the subscriber number, or 9 if you're calling from another |
|
|
|
country. Without these additional digits, your call may not connect at all! |
|
|
|
|
|
|
|
Similarly, Mexico has different mobile prefixes needed when calling from a fixed |
|
|
|
line such as 044 when calling locally, 045 when calling from another state, and |
|
|
|
1 when dialing from another country. |
|
|
|
|
|
|
|
Moreover, these countries have different possible lengths for area codes and subscriber |
|
|
|
numbers depending on the city, which further complicate matters (e.g. Buenos Aires is 11 |
|
|
|
followed by eight digits, but Río Gallegos is 2966 followed by six digits). |
|
|
|
|
|
|
|
Despite all the aforementioned complexity, users may not provide their phone number |
|
|
|
with all the additional context unless explicitly asked. For instance, |
|
|
|
since SMS messages can be sent in Argentina from a mobile phone without a prefix, |
|
|
|
the user may not supply the mobile prefix. |
|
|
|
Moreover, these countries have different possible lengths for area codes and |
|
|
|
subscriber numbers depending on the city, which further complicate matters (e.g. |
|
|
|
Buenos Aires is 11 followed by eight digits, but Río Gallegos is 2966 followed |
|
|
|
by six digits). |
|
|
|
|
|
|
|
Despite all the aforementioned complexity, users may not provide their phone |
|
|
|
number with all the additional context unless explicitly asked. For instance, |
|
|
|
since SMS messages can be sent in Argentina from a mobile phone without a |
|
|
|
prefix, the user may not supply the mobile prefix. |
|
|
|
|
|
|
|
We are aware of these issues but fixing them is not trivial. In the meantime, we |
|
|
|
recommend the following workarounds to support affected users. |
|
|
|
|
|
|
|
* If you know an Argentina or Mexico number is mobile (e.g. if you're doing |
|
|
|
signups with device numbers or will send them an SMS verification code), |
|
|
|
follow these steps: |
|
|
|
* For raw input strings: |
|
|
|
* Parse a raw input string into a `PhoneNumber` and follow the next |
|
|
|
instructions for `PhoneNumber` objects. |
|
|
|
* For `PhoneNumber` objects: |
|
|
|
* Check that the library validates a `PhoneNumber` as mobile, by |
|
|
|
calling `getNumberType`; |
|
|
|
* If not, format it in national format and prepend a `9` for Argentina |
|
|
|
or a `1` for Mexico; |
|
|
|
* Parse the modified string and if the library validates it as mobile, |
|
|
|
accept the resulting `PhoneNumber` as canonical. |
|
|
|
* Consider prompting for type (mobile or not) in the phone number input UI. |
|
|
|
|
|
|
|
IMPORTANT: Do not add a leading 1 or 9 for displaying or formatting the numbers. |
|
|
|
Depending on the use case, other tokens may be needed. The library will do the |
|
|
|
right thing if the phone number object is as intended. |
|
|
|
|
|
|
|
### Why are Bouvet Island (BV), Pitcairn Island (PN), Antarctica (AQ) etc. not supported? |
|
|
|
|
|
|
|
|