Yes, thanks, adding "+" in a front helps.
I'm ok with overhead, cause need to verify if number is valid as well. According to
international rules
On Nov 1 2019, at 11:00 am, Daniel-Constantin Mierla <miconda(a)gmail.com> wrote:
Yes, it should be a leading + to make it international, because that number can be a
local one in Germany -- in many countries the phone number length can vary, not like in US
where is fixed size.
phonenum has also some overhead if you just want to see if it is a number, maybe next one
is better:
-
https://kamailio.org/docs/modules/stable/modules/siputils.html#siputils.f.i…
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…)
Cheers,
Daniel
On 01.11.19 10:55, Igor Olhovskiy wrote:
>
> That's the main problem here.
> I just need to verify, that number came is valid. I don't have any info on
country code (means I can do a sort of regex match, but it will be overkill)
> But why number is not in international format? Or should I add leading
"+"?
> On Nov 1 2019, at 10:52 am, Daniel-Constantin Mierla <miconda(a)gmail.com>
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…)
wrote:
> >
> > Hello,
> > probably you have to use the function that has the country code:
> > -
https://kamailio.org/docs/modules/stable/modules/phonenum.html#phonenum.f.p…
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…)
> > 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(a)gmail.com>
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…)
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") and
phonenum_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(a)lists.kamailio.org
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…
(
https://link.getmailspring.com/link/DD175D56-ED77-44FB-9884-10B49B80D361@ge…
direct%253Dhttps%25253A%25252F%25252Flists.kamailio.org%25252Fcgi-bin%25252Fmailman%25252Flistinfo%25252Fsr-users%2526recipient%253DbWljb25kYUBnbWFpbC5jb20%25253D%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=c3ItdXNlcnNAbGlzdHMua2FtYWlsaW8ub3Jn)
5252Fwww.twitter.com%25252Fmiconda%2526recipient%253DbWljb25kYUBnbWFpbC5jb20%25253D%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=c3ItdXNlcnNAbGlzdHMua2FtYWlsaW8ub3Jn)
--
40%40getmailspring.com%2F10%3Fredirect%3Dhttp%253A%252F%252Fwww.linkedin.com%252Fin%252Fmiconda%26recipient%3DbWljb25kYUBnbWFpbC5jb20%253D&recipient=c3ItdXNlcnNAbGlzdHMua2FtYWlsaW8ub3Jn)