[SR-Users] Operator !~

José Luis Millán jmillan at aliax.net
Tue Apr 9 18:16:52 CEST 2013


Jon,

I guess you can find the response in [1]

```
not operator in if()

if (!$fd=~“regexp”) must now be written as if (!($fd=~“regexp”)) for what
reason ever.

Notice: the operator !~ seems not to be working for some reason as well.
e.g.: ($fd !~ 'not this') must be replaced with !($fd =~ 'not this')
```

We found the same issue when starting with Kamailio 3.X

Hope this helps.

[1]: http://www.kamailio.org/dokuwiki/doku.php/install:1.5.x-to-3.0.0


2013/4/9 Jon Bonilla <manwe at aholab.ehu.es>

> Hi all
>
> I was checking for an operator not matching regular expression. Acording
> to the
> doc we have =~ and !~ for matching and not matching.
>
> http://www.kamailio.org/wiki/cookbooks/3.3.x/core#script_statements
>
>
> I tried this one:
>
> if(!is_domain_local("$rd") && $rd !~ "^.+\.local$")
>
> Resulting on these errors:
>
> root at sp1:~# /etc/init.d/kamailio-proxy restart
> Not executing command for kamailio-proxy: invalid configuration file!
> -e
> 0(1813) : <core> [cfg.y:3549]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1067, column 36: syntax error
> 0(1813) : <core> [cfg.y:3549]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1067, column 52: bad expression
> 0(1813) : <core> [cfg.y:3549]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1067, column 52: bad command
> 0(1813) : <core> [cfg.y:3549]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1068, column 2: bad command
> 0(1813) : <core> [cfg.y:3546]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1083, column 2-21: syntax error
> 0(1813) : <core> [cfg.y:3546]: parse error in config file
> /etc/kamailio/proxy/proxy.cfg, line 1083, column 2-21:
> ERROR: bad config file (6 errors)
>
>
>
> while this one:
>
> if(!(is_domain_local("$rd") || $rd =~ "^.+\.local$"))
>
>
> Works perfectly fine.
>
> Am I wrong with the usage of !~ operator?
>
>
>
> cheers,
>
> Jon
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>



-- 
José Luis Millán
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20130409/87435ca8/attachment.htm>


More information about the sr-users mailing list