[SR-Users] is_e164 logic to detect valid number

2018-12-02 Thread Patrick Wakano
Hello list,
Hope you are all doing fine!

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 checking
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 just
2 digits? What is the case?

Thank you,
Kind regards,
Patrick Wakano
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-02 Thread Mojtaba
Hello,
it's strange that why this function (actually i mean e164_check
function) doesn’t check the length of number!
Based on Recommendation ITU-T E.164, Annex A.3 Number length, it
should be matched with one of structures that is explained there
So you could do check it yourself with regex.
With Regards. Mojtaba
On Mon, Dec 3, 2018 at 8:39 AM Patrick Wakano  wrote:
>
> Hello list,
> Hope you are all doing fine!
>
> 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 checking 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 just 2 digits? What is 
> the case?
>
> Thank you,
> Kind regards,
> Patrick Wakano
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users



-- 
--Mojtaba Esfandiari.S

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-03 Thread Henning Westerholt
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 checking
> 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 just
> 2 digits? What is the case?

Hello Patrick,

I think the implementation was done with a pragmatic approach, to make sure 
that we don't reject numbers that are used in the field. The ITU standard 
Amendment A mentions the possibility to use national short numbers, for 
example. The standard mentions that the maximal length should be 15, but I 
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


-- 
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@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-04 Thread Patrick Wakano
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  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 checking
> > 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
> just
> > 2 digits? What is the case?
>
> Hello Patrick,
>
> I think the implementation was done with a pragmatic approach, to make
> sure
> that we don't reject numbers that are used in the field. The ITU standard
> Amendment A mentions the possibility to use national short numbers, for
> example. The standard mentions that the maximal length should be 15, but I
> 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
>
>
> --
> 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@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-04 Thread Joel Serrano
You might also want to have a look at the “phonenum” module...

https://www.kamailio.org/docs/modules/5.2.x/modules/phonenum.html


On Tue, Dec 4, 2018 at 19:12 Patrick Wakano  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  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 checking
>> > 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
>> just
>> > 2 digits? What is the case?
>>
>> Hello Patrick,
>>
>> I think the implementation was done with a pragmatic approach, to make
>> sure
>> that we don't reject numbers that are used in the field. The ITU standard
>> Amendment A mentions the possibility to use national short numbers, for
>> example. The standard mentions that the maximal length should be 15, but
>> I
>> 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
>>
>>
>> --
>> 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@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-05 Thread Patrick Wakano
Thanks for the hint Joel! That's a really nice addition!
One more good reason to upgrade to version 5.2!!

Cheers,
Patrick Wakano

On Wed, 5 Dec 2018 at 14:30, Joel Serrano  wrote:

> You might also want to have a look at the “phonenum” module...
>
> https://www.kamailio.org/docs/modules/5.2.x/modules/phonenum.html
>
>
> On Tue, Dec 4, 2018 at 19:12 Patrick Wakano  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  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
>>> checking
>>> > 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
>>> just
>>> > 2 digits? What is the case?
>>>
>>> Hello Patrick,
>>>
>>> I think the implementation was done with a pragmatic approach, to make
>>> sure
>>> that we don't reject numbers that are used in the field. The ITU
>>> standard
>>> Amendment A mentions the possibility to use national short numbers, for
>>> example. The standard mentions that the maximal length should be 15, but
>>> I
>>> 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
>>>
>>>
>>> --
>>> 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@lists.kamailio.org
>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>
> ___
> Kamailio (SER) - Users Mailing List
> sr-users@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-09 Thread Daniel-Constantin Mierla
I think the function was mainly made to check if it is a telephone
number in international format.

It could be better to make this function more strict in following the
e.164 specs, there is another function to check if it looks like a
telephone number, and as pointed in another response, there is a module
for more strict checking on validity of a phone number per country...

Cheers,
Daniel

On 05.12.18 04:10, Patrick Wakano 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  > 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
> checking
> > 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 just
> > 2 digits? What is the case?
>
> Hello Patrick,
>
> I think the implementation was done with a pragmatic approach, to
> make sure
> that we don't reject numbers that are used in the field. The ITU
> standard
> Amendment A mentions the possibility to use national short
> numbers, for
> example. The standard mentions that the maximal length should be
> 15, but I
> 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
>
>
> -- 
> 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@lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference -- www.kamailioworld.com
Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com

___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users


Re: [SR-Users] is_e164 logic to detect valid number

2018-12-11 Thread Patrick Wakano
Thanks for your reply Daniel!
I agree with you, currently this function name is somewhat misleading...

Cheers,
Patrick Wakano

On Mon, 10 Dec 2018 at 18:31, Daniel-Constantin Mierla 
wrote:

> I think the function was mainly made to check if it is a telephone number
> in international format.
>
> It could be better to make this function more strict in following the
> e.164 specs, there is another function to check if it looks like a
> telephone number, and as pointed in another response, there is a module for
> more strict checking on validity of a phone number per country...
>
> Cheers,
> Daniel
> On 05.12.18 04:10, Patrick Wakano 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  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 checking
>> > 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
>> just
>> > 2 digits? What is the case?
>>
>> Hello Patrick,
>>
>> I think the implementation was done with a pragmatic approach, to make
>> sure
>> that we don't reject numbers that are used in the field. The ITU standard
>> Amendment A mentions the possibility to use national short numbers, for
>> example. The standard mentions that the maximal length should be 15, but
>> I
>> 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
>>
>>
>> --
>> Henning Westerholt - https://skalatan.de/blog/
>> Kamailio services - https://skalatan.de/services
>> Kamailio security assessment - https://skalatan.de/de/assessment
>>
>
> ___
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
> www.linkedin.com/in/miconda
> Kamailio World Conference -- www.kamailioworld.com
> Kamailio Advanced Training, Nov 12-14, 2018, in Berlin -- www.asipto.com
>
>
___
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users