[SR-Users] Operator !~
Jon Bonilla (Manwe)
manwe at aholab.ehu.es
Tue Apr 9 18:22:27 CEST 2013
El Tue, 9 Apr 2013 18:16:52 +0200
José Luis Millán <jmillan at aliax.net> escribió:
> 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
>
>
Thx Jose. Looks like the documentation (core cookbook) wasn't updated.
> 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
> >
>
>
>
More information about the sr-users
mailing list