Dominican Republic and other subprefixes

308 views
Skip to first unread message

nerijus m

unread,
Jun 16, 2022, 10:18:19 AM6/16/22
to libphonenumber-discuss

Hello,
is it possible to have separate Dominican Republic and other countries prefixes in such format, '+1-809','+1-829','+1-849' instead of just +1 ? Also need to have accordingly new phone number part which will exclude 809 from number because it would be in new prefix.
The problem is that we are losing country because +1 matches same CA and US and more countries.
These are countries that has +1 in country code:

American Samoa: +1-684
Anguilla: +1-264
Antigua and Barbuda: +1-268
Bahamas: +1-242
Barbados: +1-246
Bermuda: +1-441
British Virgin Islands: +1-284
Canada: +1
Cayman Islands: +1-345
Dominica: +1-767
Dominican Republic: +1-809, +1-829, +1-849
Grenada: +1-473
Guam: +1-671
Jamaica: +1-876
Montserrat: +1-664
Northern Mariana Islands: +1-670
Puerto Rico: +1-787
Saint Kitts and Nevis: +1-869
Saint Lucia: +1-758
Saint Vincent and the Grenadines: +1-784
Sint Maarten: +1-721
Trinidad and Tobago: +1-868
Turks and Caicos Islands: +1-649
U.S. Virgin Islands: +1-340
United States: +1
United States Minor Outlying Islands: +1

Aravind Penmetsa

unread,
Jun 26, 2022, 4:04:54 AM6/26/22
to libphonenum...@googlegroups.com
Hi,

Are you checking the feasibility for changes to canonical form of phone numbers (parsed proto)?
It is very unlikely to happen, because of the standards set and dependent apis. We do not see
a compelling reason (or reports from others) for these sensitive/huge changes to follow up.

If you would like to save the region the phone number belongs to (even in cases of shared
country codes) in the proto/canonical form of the number itself, you can have your own wrapper
proto on top of  phonenumber.proto from the library. APIs like getRegionCodeForNUmber() could
help in getting the exact region it belongs to.

Please help if I did not get you right.

--
You received this message because you are subscribed to the Google Groups "libphonenumber-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to libphonenumber-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libphonenumber-discuss/5ed85a9e-3f0d-427d-98d8-43da986e1417n%40googlegroups.com.


--
Thanks & Regards,
Aravind

David Beaumont

unread,
Jun 26, 2022, 8:56:51 AM6/26/22
to libphonenum...@googlegroups.com
You can obtain the region code (as a CLDR region code string) for a phone number via getRegionCodeForNumber(), and this should give you the information you are after.
For example, it's "LC" for "St. Lucia" etc.


Using different formatting to determine a region is not something libphonenumber intends to support, partly because we already support obtaining the region directly.

Best regards,
    David





--
David Beaumont :: Îñţérñåţîöñåļîžåţîờñ Libraries :: Google
Google Switzerland GmbH., Brandschenkestrasse 110, CH-8002, Zürich - Switzerland

nerijus m

unread,
Jun 27, 2022, 9:22:14 AM6/27/22
to libphonenumber-discuss
Hello,
this is not the same as we want.

for example:
+370 5 xxxxxxx = 0 (Vilnius fixed number) (I think this is a bug, because should be 1).
+370 37 xxxxxx = 2 (Kaunas fixed number)
+370 425 xxxxx = 3 (Akmenė fixed number)
+370 6xx xxxxx = 0 (any mobile number)
(https://en.wikipedia.org/wiki/Telephone_numbers_in_Lithuania)

or US, yes it works (in some cases)
+1 (212) xxxxxxx = 3 (New York)

But talking about DO it is the whole country, not a region
+1 (829) xxxxxxx = 3

+1 (876) xxxxxxx = 0 Jamaica, it seems also like a bug, while should be 3.
+1 (441) xxxxxxx = 0, Bermuda, it seems also like a bug, while should be 3.
etc.

So you suggesting not evenly working solution. The best would be to get 1829, 1876, 1441, etc (or +1-829, +1-876, +1-441 whatever format) as a separate method, because as I mentioned, the user enters his country prefix, as it leads back to +1 and so input != parsed input, also we cannot know is this US, CA, DO, or other country having +1 at the beginning of the prefix.

nerijus m

unread,
Jun 27, 2022, 9:29:19 AM6/27/22
to libphonenumber-discuss
I used  getRegionCodeForNumber usage in getLengthOfGeographicalAreaCode *
Reply all
Reply to author
Forward
0 new messages