Thank you, everyone, for your responses.

Benoît, thank you for providing the sample code. My concern is that the
code may become complex as it needs to be both transaction and dialog
aware. For example, it needs to be transaction-aware when sending a 100 or
200 response back and conversion from E.164 to 11 digits should happen. It
needs to be dialog-aware when FreeSWITCH initiates a BYE request so that
the conversion to 11 digits occurs. Additionally, we need to handle cases
where FreeSWITCH (on behalf of the user) initiates a call by sending an
INVITE. In these instances, I need to identify if the request is going to a
trunk that doesn't accept the "+" prefix and strip it accordingly,
potentially using a database to assist in this identification.

Ben, thank you for providing more information on the E.164 format and
clarifying that the "+" prefix is not mandatory in some cases. Yes, when I
referred to an 11-digit US number, I meant the NANP without the "+" prefix.
Replacing "+1" with "1" is sufficient for my needs, and there is no need to
identify the country.

Thanks & Regards,
Pavan Kumar

On Fri, May 31, 2024 at 8:05 PM Ben Kaufman <[email protected]> wrote:

> > 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 <[email protected]>
> Sent: Friday, May 31, 2024 8:35 AM
> To: Kamailio (SER) - Users Mailing List <[email protected]>
> Cc: Pavan Kumar <[email protected]>; Ben Kaufman <[email protected]>
> 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 <
> [email protected]> 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/
>
>
>
>
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the 
sender!
Edit mailing list options or unsubscribe:

Reply via email to