I originally sent this to sr-dev in error, I am resending to sr-users instead, thanks

Hi All,

Quick question, is it possible to use variables in the setflag function, I am trying to set a flag that is stored in a hash table using the setflag function, but I keep getting syntax errors. I am using kamailio 4.3.3.

Here's what I am trying to do:

htable core_setid defines a dispatcher setid key and its value is associated with a flag as follows:

id:key:key_type:value_type:value:expires
1:102:0:1:7:0

so, simple hash table type with an integer key of value 7 and no expiry

In dispatcher I have the following modparams set, so that ds_is_from_list() will set them if found:

modparam("dispatcher", "setid_pvname", "$var(ds_setid)")
modparam("dispatcher", "attrs_pvname", "$var(ds_setid_attrs)")

Then in my routing logic I have the following code block:

if ( ds_is_from_list() ) {
        if ( $sht(core_setid=>$var(ds_setid)) != $null ) {
            setflag( $sht(core_setid=>$var(ds_setid)) );
            return;
        } else {
            send_reply("403", "No flag set for source");
            exit;
        }
}

When I test this using kamailio -c -f <filename> I get the following error:

 0(20629) : <core> [cfg.y:3432]: yyerror_at(): parse error in config file /shared/kamailio/etc/routing_logic.cfg, line 175, column 21-52: syntax error
 0(20629) : <core> [cfg.y:3432]: yyerror_at(): parse error in config file /shared/kamailio/etc/routing_logic.cfg, line 175, column 21-52: missing '(' or ')'?
 0(20629) : <core> [cfg.y:3432]: yyerror_at(): parse error in config file /shared/kamailio/etc/routing_logic.cfg, line 175, column 21-52: bad command: missing ';'?
 0(20629) : <core> [cfg.y:3435]: yyerror_at(): parse error in config file /shared/kamailio/etc/routing_logic.cfg, line 175, column 53: bad command
ERROR: bad config file (4 errors)

If I change the setflag line to setflag(7), then I dont get the error.

I was wondering if its possible to have hashtable variables as parameters to the setflag function, or am I going about this in the wron way.

Any thoughts would be appreciated.

Thanks