Not validating some of the US area codes

289 views
Skip to first unread message

anand louis

unread,
Apr 6, 2021, 10:41:46 AM4/6/21
to libphonenumber-discuss
hi , 
I was doing some testing with 8.12.17 release and finding some usa numbers (area code and exchange code) as invalid even though these are valid . Attaching the list of area code and exchange which are valid showing as invalid. 
Any help is appreciated 

regards
Anand Louis
InvalidNumber_NewJar.xlsx

David Beaumont

unread,
Apr 6, 2021, 1:28:23 PM4/6/21
to libphonenum...@googlegroups.com
(with or without a leading '1')

This suggests that the library thinks 1 204 235 1234 is a valid number (this corresponds to tow 35 in your sheet I think).
----
Phone Number entered: 12042351234
defaultCountry entered: US
Language entered: en
Parsing Result (parseAndKeepRawInput())
country_code 1
national_number 2042351234
extension
country_code_source FROM_NUMBER_WITHOUT_PLUS_SIGN
italian_leading_zero false
raw_input 12042351234
Validation Results
Result from isPossibleNumber() true
Result from isValidNumber() true
Result from isValidNumberForRegion() false
Phone Number region CA
Result from getNumberType() FIXED_LINE_OR_MOBILE
----

Please check you're using the most up-to-date version of the library (though I doubt any of this has changed recently).

Cheers,
    David


--
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/bc602840-c87c-4b41-b7c7-ef50131dfe5en%40googlegroups.com.


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

David Cantrell

unread,
Apr 7, 2021, 4:54:44 AM4/7/21
to libphonenum...@googlegroups.com
On 06/04/2021 18:28, 'David Beaumont' via libphonenumber-discuss wrote:
> http://libphonenumber.appspot.com/phonenumberparser?number=12042351234&country=US
> <http://libphonenumber.appspot.com/phonenumberparser?number=12042351234&country=US>
> http://libphonenumber.appspot.com/phonenumberparser?number=2042351234&country=US
> <http://libphonenumber.appspot.com/phonenumberparser?number=2042351234&country=US>
> (with or without a leading '1')
>
> This suggests that the library thinks 1 204 235 1234 is a valid number
> (this corresponds to tow 35 in your sheet I think).

But it's *Canadian*, not US. Is that where the confusion lies?

--
David Cantrell

David Beaumont

unread,
Apr 7, 2021, 5:18:43 AM4/7/21
to libphonenum...@googlegroups.com
Good point. The +1 means it's NANPA, but that covers a lot of region codes. See https://en.wikipedia.org/wiki/North_American_Numbering_Plan#Countries_and_territories

Thanks for spotting that David!

David


--
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.

anand louis

unread,
Apr 7, 2021, 6:21:51 AM4/7/21
to libphonenum...@googlegroups.com
Thanks
Looks like these numbers I got as invalid is from Canada and Carebian Islands. I was passing US as country code in my function . 

Is there any function that can be used to get the probable country ISO name by just passing the number ?

regards
Anand Louis


You received this message because you are subscribed to a topic in the Google Groups "libphonenumber-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/libphonenumber-discuss/o-evaKOu_iU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to libphonenumber-di...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/libphonenumber-discuss/CAKxGnntEGvJbvMCCLBag16dvnU%3DBAU3ppb2FYG_WvGSjHfNobA%40mail.gmail.com.


--
______________________________________________________________________________________________________
             "The sure path to failure is to give up! It is often through failure that future success come – KEEP TRYING!"

Lara Scheidegger

unread,
Apr 7, 2021, 2:14:17 PM4/7/21
to libphonenum...@googlegroups.com
Passing in US or CA will make no difference to parsing... However, if you ask if it's valid for US with isValidNumberForRegion it will tell you it's not, it's valid for CA. What method are you calling to generate your results?

Also, what do you mean "passing the number" and what problem are you trying to solve?

anand louis

unread,
Apr 13, 2021, 2:28:46 AM4/13/21
to libphonenum...@googlegroups.com
I figured out what I was looking for . Thanks a lot for the help . 

Just one question. Generally how often Phone metadata for the USA change?Like adding new area code and exchange etc 
This will help us to know how often we have to upgrade the jar .

Reply all
Reply to author
Forward
0 new messages