[SR-Users] @msg.%s syntax

Andrei Pelinescu-Onciul andrei at iptel.org
Mon Mar 29 17:01:00 CEST 2010


On Mar 29, 2010 at 14:49, Juha Heinanen <jh at tutpro.com> wrote:
> Juha Heinanen 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)
>  >  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
> 
> just to add, 
> 
> $var(calling_uri) = @msg["Referred-By"].nameaddr.uri;
> 
> does not produce syntax errors, but generates this kind of error message
> at proxy restart:
> 
> Mar 29 14:47:59 localhost /usr/sbin/sip-proxy[2681]: ERROR: <core> [select.c:315]: Unable to resolve select 'Referred-By' at level 1
> Mar 29 14:47:59 localhost /usr/sbin/sip-proxy[2681]: BUG: <core> [rvalue.c:2771]: Unable to resolve select

Looks like a doc error and a logging error (BUG instead of ERROR).

It should be:
@msg.header["h_name"]
or
@msg.header["h_name"][number]  (selects the "number" h_name)

You could also use the @msg.h["..."] shortcut (IIRC is equiv to
@msg.header).

See
http://sip-router.org/docbook/sip-router/branch/master/select_list/select_list.html#select_list.core
(they should be up-to-date and correct and the name is mostly
self-explaining)



Andrei




More information about the sr-users mailing list