Hi Daniel,
Thanks for the alternative workaround, but I think I will stick with AVP
module tests for the moment, it seems like a little bit of a resource
waste having to set another avp to test for an avp that is already
loaded up by the domain module.
Thanks for the information.
Cheers
On 13/11/2017 08:38, Daniel-Constantin Mierla wrote:
Hello,
avp module comes from ser branch, probably it is the reason it was
mentioned to be deprecated. However, avpops was developed with only one
avp list in mind (caller list).
Anyhow, avps do not evaluate the names as a string, but a single
variable, maybe you can try like:
$avp(x) = $_s(dm_ds_setid_$rm);
then: is_avp_set("$avp($avp(x))")
or: if($avp($avp(x))!=$null)
If it is not in pair with avpops, then avp module won't be removed.
Cheers,
Daniel
On 10.11.17 17:00, Asgaroth wrote:
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
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users