i played a bit more with selects and found that statement
if ($sht(auth=>foo::count) > @cfg_get.local.gw_timeout) { xlog("foo"); }
produces error
0(9213) : <core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 507, column 28-55: bad expression: type mismatch: str instead of int at (507,55)
but the error goes away if i either make explicit conversion
if ($sht(auth=>foo::count) > (int)@cfg_get.local.gw_timeout) { xlog("foo"); }
or use $sel
if ($sht(auth=>foo::count) > $sel(cfg_get.local.gw_timeout)) { xlog("foo"); }
this is thus exactly opposite than in my t_set_fr ordeal where i got conversion error when i used $sel instead of @.
in my opinion, no (int) conversion should be needed in the firs case, because the value of the cfg variable is int.
in summary, writing statements that include selects is very difficult and error prone.
-- juha
On 3/31/10 8:40 AM, Juha Heinanen wrote:
i played a bit more with selects and found that statement
if ($sht(auth=>foo::count)> @cfg_get.local.gw_timeout) { xlog("foo"); }
I guess selects have types, while pseudo-variables are kind of type agnostic. Any PV has a string representation of the value, comparison is done as integer if both PVs are integers, otherwise is done as string.
The safe side is to use PV representation of selects when comparing with another PV.
PV and selects is another point for the future coherence.
Cheers, Daniel
produces error
0(9213) :<core> [cfg.y:3379]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 507, column 28-55: bad expression: type mismatch: str instead of int at (507,55)
but the error goes away if i either make explicit conversion
if ($sht(auth=>foo::count)> (int)@cfg_get.local.gw_timeout) { xlog("foo"); }
or use $sel
if ($sht(auth=>foo::count)> $sel(cfg_get.local.gw_timeout)) { xlog("foo"); }
this is thus exactly opposite than in my t_set_fr ordeal where i got conversion error when i used $sel instead of @.
in my opinion, no (int) conversion should be needed in the firs case, because the value of the cfg variable is int.
in summary, writing statements that include selects is very difficult and error prone.
-- juha
Kamailio (OpenSER) - Users mailing list Users@lists.kamailio.org http://lists.kamailio.org/cgi-bin/mailman/listinfo/users http://lists.openser-project.org/cgi-bin/mailman/listinfo/users