[sr-dev] [kamailio/kamailio] Parsing a number using `phonenum_match_cn()` doesn't restrict the rules with the country name code (#2495)

Joel Serrano notifications at github.com
Fri Oct 2 03:11:07 CEST 2020


### Description

Parsing a number using `phonenum_match_cn()` doesn't honor the country code filter.

#### Reproduction

I have the following in code:

```
    if (phonenum_match_cn("$fU", "PA", "src")) {
        if($phn(src=>valid)==1) {
            xlog("L_NOTICE", "Caller is type: (V=$phn(src=>valid) | N=$phn(src=>number) | NN=$phn(src=>normalized) | CC=$phn(src=>cctel) | ISO=$phn(src=>ccname) | T=$phn(src=>ltype) | D=$phn(src=>ndesc))\n");
            return;
        }
    }
```

Using `+15162085XXX` as an example, I'm getting the following when passing that snippet of code:

```
Oct  1 19:31:11 sbc01 sbc[17850]: NOTICE: {1 102 INVITE 05d2e55e06832c71060e69b630cd5c6d at A.B.C.D} <script>: Caller is type: (V=1 | N=+15162085XXX | NN=+15162085XXX | CC=1 | ISO=US | T=fixed-line-or-mobile | D=New York)
```

I would expect this case to return `$phn(src=>valid)=0`

### Additional Information

* **Kamailio version**:

```
version: kamailio 5.4.1 (x86_64/linux)
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 6.3.0
```

* **Operating System**:

```
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.13 (stretch)
Release:	9.13
Codename:	stretch
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2495
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20201001/765283f4/attachment.htm>


More information about the sr-dev mailing list