[SR-Users] @msg.%s syntax

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Mar 29 16:55:33 CEST 2010


On Mar 29, 2010 at 13:26, Juha Heinanen <jh at tutpro.com> wrote:
> Andrei Pelinescu-Onciul writes:
> 
>  > This is equivalent to @msg[%s] (so there is no error in this case).
>  > E.g. @msg["P-Foo"] is equivalent with @msg.P-Foo.
> 
> i tried
> 
> $var(calling_uri) = @msg.Referred-By.nameaddr.uri;
> 
> and got syntax errors:
>  0(22068) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 43: syntax error
>  0(22068) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 43: '('')' expected (function call)


This particular header name won't work this way because it has a '-' and
the parser intterprets it as as:
 @msg.Referred  - By.nameaddr.uri

(that's why you get the error about missing (), the parser thinks you
wanted to call a function named By.nameaddr.uri())

So if a select parameter contains a special characted (or better
anything besides [a-zA-Z0-9_]), use ["..."] (we should document it
somewhere).

> 
>  0(22068) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 40-43: bad expression: type mismatch: str instead of int at (961,40)
>  0(22068) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 43: bad command
>  0(22068) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 52: '('')' expected (function call)
>  0(22068) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 52: bad command: missing ';'?
>  0(22068) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 961, column 53-55: bad command
> 

Andrei




More information about the sr-users mailing list