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@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@lists.kamailio.org>; Vicente Hernando <vhernando@sonoc.io>; Javier Gallart <jgallart@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
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
--
|
||||||||||||||||||||
|