the phonenum module is pretty decent for helping with NANP numbers and
deciphering if one is let’s say US vs Canada vs Jamaica, etc.
Absolutely. And if his use case is to actually get the political country, it's a great choice. With that said, I'm guessing that in his case the vendor wants the + removed for all NANP numbers, so my point was to only use libphonenumber for this if was critical to differentiate the USA from the rest of the NANP.
-----Original Message----- From: Fred Posner fred@pgpx.io Sent: Friday, May 31, 2024 8:35 AM To: Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org Cc: Pavan Kumar pavanputhra@gmail.com; Ben Kaufman bkaufman@bcmone.com Subject: Re: [SR-Users] Assistance Needed: Converting 11-Digit US Numbers to E.164 in Kamailio
CAUTION: This email originated from outside the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
On May 31, 2024, at 9:20 AM, Ben Kaufman via sr-users sr-users@lists.kamailio.org wrote:
Answered in order of easiest answer to most complex:
Does it start with a 0?
No. I've never encountered any US number requiring a prefix of "0" nor a US number being written that way.
US numbers are fixed lenght 11 digits?
The USA is in the North American Numbering Plan (NANP). This includes USA, Canada, much of the Caribbean (Cuba, Jamaica, Barbados for example), some US territories in the Pacific (Guam, American Samoa). The NANP's "Country Code" is 1. In the USA and Canada (I think the entirety of the NANP) this is followed with a 3 digit area code (National Destination Number) followed by a 7 digit subscriber number.
What is the usual representation of a 'local' US number?
There is no consistent answer. Consider that the oldest phone network is in the USA, and the unplanned initial growth and many historic regional governing bodies it varies massively. It has also changed greatly over time. GENERALLY speaking people will use the 11 digit number or the 10 digit number (without the "1" country code), but there's not a lot of rhyme or reason as to which is preferred in one case vs another.
It was mentioned previously, and requires libphonenumber, but the phonenum module is pretty decent for helping with NANP numbers and deciphering if one is let’s say US vs Canada vs Jamaica, etc.
Regards,
Fred Posner p: +1 (352) 664-3733 https://fred.tel/