[SR-Users] Phonenum module

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 1 10:52:04 CET 2019


Hello,

probably you have to use the function that has the country code:

  -
https://kamailio.org/docs/modules/stable/modules/phonenum.html#phonenum.f.phonenum_match_cn

Because the number is not in international format.

Cheers,
Daniel

On 01.11.19 10:42, Igor Olhovskiy wrote:
> Tried with doublequotes and without em.
>
> Log string is only
> kamailio_1    | 10(17) exec: ***
> cfgtrace:request_route=[INITIAL_CHECK] c=[/etc/kamailio/kamailio.cfg]
> l=640 a=16 n=if
> kamailio_1    |  9(16) DEBUG: phonenum [phonenum_pv.c:332]:
> phonenum_update_pv(): phonenum PV updated for: 380442459966
> (0/none/Parsing number failed)
> kamailio_1    |  9(16) exec: ***
> cfgtrace:request_route=[INITIAL_CHECK] c=[/etc/kamailio/kamailio.cfg]
> l=669 a=16 n=if
> kamailio_1    |  9(16) exec: ***
> cfgtrace:request_route=[INITIAL_CHECK] c=[/etc/kamailio/kamailio.cfg]
> l=665 a=26 n=send_reply
>
> On Nov 1 2019, at 10:31 am, Daniel-Constantin Mierla
> <miconda at gmail.com> wrote:
>
>
>     Hello,
>
>     can you try with the first parameter in between double quotes ("$fU")?
>
>     Otherwise, set debug=3 and provide all log messages printed by
>     kamailio when executing the phonenum_match() function.
>
>     Cheers,
>     Daniel
>
>     On 01.11.19 10:10, Igor Olhovskiy wrote:
>
>
>         Hi!
>
>         I'm playing around libphonenum to get validation accross e.164
>         numbers.
>
>
>         So, idea is simple
>         if (phonenum_match($fU, "src_num")) {
>                 if ($phn(src_num=>valid) != 1) {
>                     send_reply("400", "Invalid e.164 format");
>                     xlog("L_ALERT","ALERT: FU: $fU is not e.164 number
>         $phn(src_num=>error)\n");
>                     exit;
>                 }
>         }
>
>         But on every (actually valid e.164 number like 380442459966 or
>         61388141397) I got  Parsing number failed in error result.
>
>         Tried both phonenum_match($fU, "src_num")
>         andphonenum_match("$fU", "src_num")
>
>         Actually phonenum_match("380442459966", "src_num") also not
>         working
>
>         Debian 10 Buster
>         version: kamailio 5.2.5 (x86_64/linux)
>         libphonenumber7 is already the newest version (7.1.0-5+b4).
>
>         |
>
>         _______________________________________________
>         Kamailio (SER) - Users Mailing List
>         sr-users at lists.kamailio.org <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/0?redirect=mailto%3Asr-users%40lists.kamailio.org&recipient=bWljb25kYUBnbWFpbC5jb20%3D>https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/1?redirect=https%3A%2F%2Flists.kamailio.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fsr-users&recipient=bWljb25kYUBnbWFpbC5jb20%3D>
>
>         |
>
>     |
>
>     -- 
>     Daniel-Constantin Mierla -- www.asipto.com <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/2?redirect=http%3A%2F%2Fwww.asipto.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D>www.twitter.com/miconda <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/3?redirect=http%3A%2F%2Fwww.twitter.com%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D> -- www.linkedin.com/in/miconda <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/4?redirect=http%3A%2F%2Fwww.linkedin.com%2Fin%2Fmiconda&recipient=bWljb25kYUBnbWFpbC5jb20%3D>
>     Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com <https://link.getmailspring.com/link/1D1DF284-F963-4251-A8F1-C242A43A8ABF@getmailspring.com/5?redirect=http%3A%2F%2Fwww.kamailioworld.com&recipient=bWljb25kYUBnbWFpbC5jb20%3D>
>
>     |
>
> Sent from Mailspring 

-- 
Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - April 27-29, 2020, in Berlin -- www.kamailioworld.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20191101/ee21b5de/attachment.html>


More information about the sr-users mailing list