[SR-Users] Operator !~

Jon Bonilla (Manwe) manwe at aholab.ehu.es
Tue Apr 9 17:48:06 CEST 2013


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




More information about the sr-users mailing list