Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some +8xx ranges can be stubbed using libphonenumber data but aren't #17

Closed
theory opened this issue Apr 16, 2014 · 14 comments
Closed

Some +8xx ranges can be stubbed using libphonenumber data but aren't #17

theory opened this issue Apr 16, 2014 · 14 comments
Labels
Projects

Comments

@theory
Copy link
Contributor

theory commented Apr 16, 2014

These tests will fail:

my $toll_free = '+1 (866) 623 2282';
my $tf = Number::Phone::Lib->new($toll_free);
isa_ok $tf, 'Number::Phone::StubCountry::US';
is($tf->country_code(), 1, "Number::Phone::Lib->new('$toll_free')->country_code()");
is($tf->country(), 'US', "Number::Phone::Lib->new('$the_man')->country()");
is($tf->areaname(), undef, "Number::Phone::Lib->new('$toll_free')->areaname()");
is($tf->format, '+1 866 623 2282', "Number::Phone::Lib->new('$toll_free')->format()");

I suspect it's because international toll-free numbers are ignored by this code in build-data.stubs:

  if($ISO_country_code !~ /^..$/) {
    warn("skipping 'country' $ISO_country_code (+$IDD_country_code)\n");
    next TERRITORY;
  }

Can we restore this and get the country lookup to recognize toll-fee numbers?

@DrHyde
Copy link
Owner

DrHyde commented Apr 16, 2014

Would you like a commit bit? :-)

@theory
Copy link
Contributor Author

theory commented Apr 16, 2014

Oy, no. Just need validation and formatting working properly at work. I don't care about any of the rest of it. :-)

theory added a commit to theory/perl-modules-Number-Phone that referenced this issue Apr 16, 2014
@DrHyde
Copy link
Owner

DrHyde commented Apr 17, 2014

I merged your PR which fixes this

@DrHyde DrHyde closed this as completed Apr 17, 2014
@theory
Copy link
Contributor Author

theory commented Apr 17, 2014

Er, no, I did not fix this in #16. The toll-free number "country codes" are still skipped in build-data.stubs:

  if($ISO_country_code !~ /^..$/) {
    warn("skipping 'country' $ISO_country_code (+$IDD_country_code)\n");
    next TERRITORY;
  }

@DrHyde DrHyde reopened this Apr 17, 2014
@DrHyde
Copy link
Owner

DrHyde commented Apr 17, 2014

Ah, OK, I was confused because the test is for a +1-8xx number, not a +8xx number

@theory
Copy link
Contributor Author

theory commented Apr 17, 2014

Me too!

@DrHyde DrHyde changed the title Toll-Free Numbers Not Recognized by libphonenumber +8xx Numbers Not Recognized by libphonenumber Apr 17, 2014
@DrHyde
Copy link
Owner

DrHyde commented Apr 20, 2014

... and closed again, because they get instantiated as N::P::StubCountry

@DrHyde DrHyde closed this as completed Apr 20, 2014
@theory
Copy link
Contributor Author

theory commented Apr 20, 2014

Is that okay? Should they not get formats associated with them? For example, 800:

<territory id="001" countryCode="800" leadingZeroPossible="true">
  <availableFormats>
    <numberFormat pattern="(\d{4})(\d{4})">
      <format>$1 $2</format>
    </numberFormat>
  </availableFormats>

@DrHyde DrHyde reopened this Apr 24, 2014
@DrHyde
Copy link
Owner

DrHyde commented Apr 24, 2014

This is a nice-to-have, but there are architectural problems in N::P::Country[::Data].

Never mind the repetition of data, but it also assumes that each "country" has at most one country code. InternationalNetworks has 2, and Inmarsat has 5.

libphonenumber only knows about one of Inmarsat's codes (the other four are old and being replaced by the the new one, but I think are still in service), but it does know about +882 and +883. When I add support for these, need to have thorough tests for 882/883.

@DrHyde DrHyde changed the title +8xx Numbers Not Recognized by libphonenumber Some +8xx ranges can be stubbed using libphonenumber data but aren't Apr 24, 2014
@theory
Copy link
Contributor Author

theory commented Apr 24, 2014

Thanks. The US-style toll-free numbers are good enough for me, since we require country codes for all numbers, anyway.

@DrHyde
Copy link
Owner

DrHyde commented Sep 5, 2014

I just had a mailing list created for Number::Phone users: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/number-phone

@DrHyde DrHyde added this to Backlog in Maintenance Aug 24, 2021
@DrHyde DrHyde added the bug label Jan 4, 2023
@DrHyde
Copy link
Owner

DrHyde commented Jan 6, 2023

working on this in branch add-8xx-ranges

@DrHyde
Copy link
Owner

DrHyde commented Jan 12, 2023

Pull request #114

@DrHyde
Copy link
Owner

DrHyde commented Jan 20, 2023

Merged and will be in the next release

@DrHyde DrHyde closed this as completed Jan 20, 2023
Maintenance automation moved this from Backlog to Done Jan 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

2 participants