[Kamailio-Users] more type conversion wonders

Juha Heinanen jh at tutpro.com
Wed Mar 31 08:40:19 CEST 2010


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



More information about the Users mailing list