[SR-Users] is_e164 logic to detect valid number
pwakano at gmail.com
Wed Dec 5 23:08:19 CET 2018
Thanks for the hint Joel! That's a really nice addition!
One more good reason to upgrade to version 5.2!!
On Wed, 5 Dec 2018 at 14:30, Joel Serrano <joel at textplus.com> wrote:
> You might also want to have a look at the “phonenum” module...
> On Tue, Dec 4, 2018 at 19:12 Patrick Wakano <pwakano at gmail.com> wrote:
>> Thanks for the replies guys!
>> I will probably add a length test to invalidate too short numbers!
>> By the way, I had a quick look in the ITU recommendation (
>> https://www.itu.int/rec/T-REC-E.164/en) and looks like the short numbers
>> are for local purposes only being part of the "Non-ITU-T E.164 numbers"
>> section, so I guess the function should return false in this case. Also it
>> seems the + sign is recommended but not mandatory for a E.164 number, which
>> is quite confusing.....
>> Kind regards,
>> Patrick Wakano
>> On Tue, 4 Dec 2018 at 08:57, Henning Westerholt <hw at kamailio.org> wrote:
>>> Am Montag, 3. Dezember 2018, 06:08:27 CET schrieb Patrick Wakano:
>>> > I am using the is_e164() function to validate the number we receive,
>>> and I
>>> > come to see that the number +555 was accepted....
>>> > After some googling it looks like(it is not very clear though) that 7
>>> > digits are the minimum we could have for e164 numbers but after
>>> > the source code, I saw it accepts anything starting with + and having
>>> > between 2 and 16 numbers. So is it really valid to have a number with
>>> > 2 digits? What is the case?
>>> Hello Patrick,
>>> I think the implementation was done with a pragmatic approach, to make
>>> that we don't reject numbers that are used in the field. The ITU
>>> Amendment A mentions the possibility to use national short numbers, for
>>> example. The standard mentions that the maximal length should be 15, but
>>> think in this case this was also implemented a bit more relaxed.
>>> The original implementation from the enum module allows even longer
>>> numbers, I
>>> will check if this should be synchronized.
>>> Best regards,
>>> Henning Westerholt - https://skalatan.de/blog/
>>> Kamailio services - https://skalatan.de/services
>>> Kamailio security assessment - https://skalatan.de/de/assessment
>> Kamailio (SER) - Users Mailing List
>> sr-users at lists.kamailio.org
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the sr-users