i stored timeouts to local cfg variables and tried to set them with t_set_fr:
xlog("about to set fr to $sel(cfg_get.local.invite_timeout)/$sel(cfg_get.local.gw_timeout)\n"); t_set_fr("$sel(cfg_get.local.invite_timeout)", "$sel(cfg_get.local.gw_timeout)"); xlog("after setting fr\n");
unfortunately, the above t_set_fr results in syslog error:
Mar 30 21:05:10 localhost /usr/sbin/sip-proxy[31365]: ERROR: about to set fr to 75000/3000 Mar 30 21:05:10 localhost /usr/sbin/sip-proxy[31365]: ERROR: <core> [sr_module.c:1546]: Could not convert PV to int Mar 30 21:05:10 localhost /usr/sbin/sip-proxy[31365]: ERROR: after setting fr
why is that? the two local cfg variables have been set to int values and no conversion should be needed:
Mar 30 21:05:00 localhost /usr/sbin/sip-proxy[31367]: INFO: Handling XMLRPC POST from <127.0.0.1> with body <<?xml version="1.0" ?><methodCall><methodName>cfg.set_now_int</methodName><params><param><value><string>local</string></value></param><param><value><string>invite_timeout</string></value></param><param><value><int>75000</int></value></param></params></methodCall>> Mar 30 21:05:00 localhost /usr/sbin/sip-proxy[31367]: INFO: <core> [cfg/cfg_ctx.c:411]: INFO: cfg_set_now(): local.invite_timeout has been changed to 75000 Mar 30 21:05:03 localhost /usr/sbin/sip-proxy[31363]: INFO: Handling XMLRPC POST from <127.0.0.1> with body <<?xml version="1.0" ?><methodCall><methodName>cfg.set_now_int</methodName><params><param><value><string>local</string></value></param><param><value><string>gw_timeout</string></value></param><param><value><int>3000</int></value></param></params></methodCall>> Mar 30 21:05:03 localhost /usr/sbin/sip-proxy[31363]: INFO: <core> [cfg/cfg_ctx.c:411]: INFO: cfg_set_now(): local.gw_timeout has been changed to 3000
this is with current master branch.
-- juha
ps. it took a while before i found where the error comes from because there is no script line number in the message.
Juha Heinanen writes:
t_set_fr("$sel(cfg_get.local.invite_timeout)", "$sel(cfg_get.local.gw_timeout)");
unfortunately, the above t_set_fr results in syslog error:
Mar 30 21:05:10 localhost /usr/sbin/sip-proxy[31365]: ERROR: <core> [sr_module.c:1546]: Could not convert PV to int
why is that?
i don't know why, but the error went away when i changed syntax of the function call to this:
t_set_fr("@cfg_get.local.invite_timeout", "@cfg_get.local.gw_timeout);
so looks like $sel is not equivalent to @.
-- juha
On Mar 31, 2010 at 09:11, Juha Heinanen jh@tutpro.com wrote:
Juha Heinanen writes:
t_set_fr("$sel(cfg_get.local.invite_timeout)", "$sel(cfg_get.local.gw_timeout)");
unfortunately, the above t_set_fr results in syslog error:
Mar 30 21:05:10 localhost /usr/sbin/sip-proxy[31365]: ERROR: <core> [sr_module.c:1546]: Could not convert PV to int
why is that?
i don't know why, but the error went away when i changed syntax of the function call to this:
t_set_fr("@cfg_get.local.invite_timeout", "@cfg_get.local.gw_timeout);
so looks like $sel is not equivalent to @.
Could you try something like:
$x=$sel(...)); $y=@...; $z=(int)$sel(...);
and print the values with xlog? If $x!=$y, please put it on the bug tracker (and assign Daniel to it :-)).
Andrei
Andrei Pelinescu-Onciul writes:
Could you try something like:
$x=$sel(...)); $y=@...; $z=(int)$sel(...);
and print the values with xlog? If $x!=$y, please put it on the bug tracker (and assign Daniel to it :-)).
i can write
if ($sel(cfg_get.local.phone_timeout) != @cfg_get.local.phone_timeout) { xlog("not equal\n"); };
and nothing gets printed to syslog, i.e., it seems to work.
but if i replace != with <, sr does not even start, but prints
0(7102) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 518, column 40-70: bad expression: type mismatch: str instead of int at (518,70) 0(7102) : <core> [cfg.y:3382]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 520, column 6: bad command
same, if i try
if ((int)$sel(cfg_get.local.phone_timeout) > @cfg_get.local.phone_timeout) { xlog("not equal\n"); };
but if in move (int) to @ select
if ($sel(cfg_get.local.phone_timeout) > (int)@cfg_get.local.phone_timeout) { xlog("not equal\n"); };
then the start error goes away.
so to me it looks like there is a bug in parsing of @cfg_get.local.phone_timeout. there is no way the parser could know the type of @ select. it can only be determined at run time.
is this a "feature" or a bug that i should add to the tracker.
-- juha