[SR-Users] AVPOPS: is_avp_set/avp_check "name" parameter as variable.

Asgaroth 00asgaroth00 at gmail.com
Fri Nov 10 17:00:32 CET 2017


Hi All,

I was having a read of the AVP module documentation and I see mentioned 
that in future releases of kamailio that the AVP module may become 
deprecated in favour of using AVPOPS module. To this end, I started 
looking to switch some of AVP functions over to AVPOPS functions when I 
cam across an issue where I cannot have the name parameter of the avp to 
check a variable.

I have some attributes defined for a domain which I load up using 
lookup_domain, one of these attributes is a dispatcher setid based on 
the request method being processed. So, with AVP I can do something like 
the following to see if it is set:

if ( attr_exists( $_s(dm_ds_setid_$rm) ) )

The above works as expected, but if I try using something equivelent 
using avpops functions, something like:

if ( is_avp_set("$avp(s:$_s(dm_ds_setid_$rm))") )
or
if ( is_avp_set("$avp(s:dm_ds_setid_$rm)") )
or
if ( is_avp_set("$avp($_s(dm_ds_setid_$rm))") )
or
if ( is_avp_set("$avp(dm_ds_setid_$rm)") )

Then it fails the check even though the avp is set correctly, there are 
no errors in the logs so it all appears to be okay.

Likewise, when checking with the following AVP function, it works:

if ( attr_equals("$_s(dm_ds_setid_$rm)", "100") )

But, if I try with AVPOPS function, it fails (I'm guessing its bacause 
the avp cannot be found)

if ( avp_check("$avp(s:$_s(dm_ds_setid_$rm))", "100") )
or
if ( avp_check("$avp(s:dm_ds_setid_$rm)", "100") )
or
if ( avp_check("$avp($_s(dm_ds_setid_$rm))", "100") )
or
if ( avp_check("$avp(dm_ds_setid_$rm", "100") )

Are the AVPOPS functions able to take nested variables like the above? 
Is this a bug or am I using them incorrectly?

I'm currently trying this out on kamailio v5.0.4.

Any thoughts on the issue would be appreciated.

Thanks



More information about the sr-users mailing list