[SR-Users] issue using phonenum module

David Escartín descartin at sonoc.io
Mon Jun 13 16:21:57 CEST 2022


hello,

i'm using
if (phonenum_match_cn("$var(canonized_ani)", "ZZ", "ani")) {
....

where $var(canonized_ani) holds in this case "+576015145834"

best regards
david

El lun, 13 jun 2022 a las 16:16, Ben Kaufman (<bkaufman at bcmone.com>)
escribió:

> How are you calling the function in Kamailio?  It’s possible that the
> appspot app tries a few variations on formatting that result in success.
> From the phonum module doc for phonenum_match_cn(num, cnc, pvc) :
>
>
>
>
>
> Note from libphonenumber library docs: country name code is the region
> that is expected the number to be from. It is only used if the number being
> parsed is not written in international format. The country code for the
> number in this case would be stored as that of the region supplied. If the
> number is guaranteed to start with a '+' followed by the country calling
> code, then region 'ZZ'.
>
>
>
>
>
>
>
> *Kaufman*
>
>
>
> *From:* sr-users <sr-users-bounces at lists.kamailio.org> * On Behalf Of *David
> Escartín
> *Sent:* Monday, June 13, 2022 8:49 AM
> *To:* Kamailio (SER) - Users Mailing List <sr-users at lists.kamailio.org>;
> Vicente Hernando <vhernando at sonoc.io>; Javier Gallart <jgallart at sonoc.io>
> *Subject:* [SR-Users] issue using phonenum module
>
>
>
> Hello all
>
>
>
> we are using the phonenum_match_cn function to detect valid phone numbers,
> but seems there are some numbers like 576015145834 which are no detected as
> valid ones,
>
> $phn(ani=>valid) --> 0
> $phn(ani=>ccname) --> <null>
> $phn(ani=>cctel) --> 0
> $phn(ani=>error) --> Invalid number
>
>
>
> but using
>
>
> https://libphonenumber.appspot.com/phonenumberparser?number=576015145834&country=CO
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flibphonenumber.appspot.com%2Fphonenumberparser%3Fnumber%3D576015145834%26country%3DCO&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=pLAOjgn9o61nk03k7%2FgRsLKinYDTnHTs2%2FNgd%2BK%2BG40%3D&reserved=0>
> seems it gives a valid result
>
>
>
> Validation Results
> Result from isPossibleNumber() true
> Result from isValidNumber() true
> Result from isValidNumberForRegion() true
> Phone Number region CO
> Result from getNumberType() FIXED_LINE
>
>
>
> we are using kamailio 5.4 and libphonenumber tag v8.12.30 (also tested
> v8.9)
>
> the command is used with 'ZZ' cnc and passing the number with +
>
>
>
> maybe we are missing something in the configuration/setup?
>
> thanks and regards
> david
>
>
>
> --
>
>
> <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.sonoc.io%2F&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=59dpA3rMEP1RnAWzDYwuNzdQ1zAbViC7yPjY26hgWGU%3D&reserved=0>
>
> David Escartín
>
> NOC engineer
>
> *www.sonoc.io*
> <https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.sonoc.io%2F&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=59dpA3rMEP1RnAWzDYwuNzdQ1zAbViC7yPjY26hgWGU%3D&reserved=0>
>
> [image: LinkedIn]
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.linkedin.com%2Fcompany%2Fsonoc&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=%2B%2BQrJtOr4eDeCStfkSqskYmKZKiry7WCgCTuUKUxCiU%3D&reserved=0>
>
> [image: Twitter]
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2Fsonoc_&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=kWxD3cUTYKmEcKGcTka%2FwHQ%2FNpFjtDvrqQm%2BzwLqNH4%3D&reserved=0>
>
> [image: Facebook]
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.facebook.com%2FSONOCio%2F&data=05%7C01%7Cbkaufman%40bcmone.com%7Cb2f5358948fa4e8c467508da4d43974a%7Cafc1818e7b6848568913201b9396c4fc%7C1%7C0%7C637907249957000424%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000%7C%7C%7C&sdata=lv6mhnoPr0YOopcKSmH5PZw5nim2lAsxB0XqhLv65dw%3D&reserved=0>
>
> This e-mail is for the exclusive use of its recipients and may contain
> business secrets or other confidential or privileged information. Any
> unauthorised use, copying, publication or distribution of this e-mail is
> strictly prohibited. If you are not the intended recipient, please inform
> us immediately by replying to this e-mail and delete it, including any
> attachments or copies on your system.
>
> In accordance with the GDPR (EU) 2016/679 and the LOPDGDD 3/2018, we
> inform you that this e-mail address and/or any other personal data you have
> provided us with will be treated by SONOC with absolute confidentiality and
> with the only purpose of providing you with the requested services, due to
> your condition as a client, supplier or because you have requested
> information from us at any time. These data will only be kept for as long
> as required to comply with legal obligations. You can exercise your rights
> at any time by sending an e-mail to: *dataprotection at sonoc.io*
> <dataprotection at sonoc.io>*.* <dataprotection at sonoc.io>
>
>
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to
> the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
>

-- 
[image: Logo]

David Escartín Almudévar
VoIP/Switch Engineer
descartin at sonoc.io

*SONOC*
C/ Josefa Amar y Borbón, 10, 4ª · 50001 Zaragoza, España
Tlf: +34 917019888 · www.sonoc.io

David Escartín
NOC engineer
www.sonoc.io
This e-mail is for the exclusive use of its recipients and may contain business secrets or other confidential or privileged information. Any unauthorised use, copying, publication or distribution of this e-mail is strictly prohibited. If you are not the intended recipient, please inform us immediately by replying to this e-mail and delete it, including any attachments or copies on your system.
​
In accordance with the GDPR (EU) 2016/679 and the LOPDGDD 3/2018, we inform you that this e-mail address and/or any other personal data you have provided us with will be treated by SONOC with absolute confidentiality and with the only purpose of providing you with the requested services, due to your condition as a client, supplier or because you have requested information from us at any time. These data will only be kept for as long as required to comply with legal obligations. You can exercise your rights at any time by sending an e-mail to: dataprotection at sonoc.io.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220613/7d388df9/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image174985.png
Type: image/png
Size: 791 bytes
Desc: image174985.png
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220613/7d388df9/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image636986.png
Type: image/png
Size: 830 bytes
Desc: image636986.png
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220613/7d388df9/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image667452.png
Type: image/png
Size: 810 bytes
Desc: image667452.png
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20220613/7d388df9/attachment-0002.png>


More information about the sr-users mailing list