Hi all,
What's the most efficient way to check if an xavp is set?
I have tried-
is_avp_set() from avpops module
which resulted in-
ERROR: avpops [avpops.c:915]: fixup_is_avp_set(): bad attribute name <$xavp(tm_contacts)>
and
if ($xavp(tm_contacts)) {}
which resulted in -
WARNING: <core> [rvalue.c:1007]: rval_get_int(): automatic string to int conversion for "<xavp:0x7feac74cfcb8>" failed
To give a little background, I am using the UAC_redirect module and t_next_contacts() in conjunction with 302 redirects .However if there is only a single contact, $xavp(tm_contacts) is not created and t_next_contacts() fails, hence why I'd like to check if it exists first.
Thanks
Try:
if(defined $xavp(tm_contacts))
or:
if($xavp(tm_contacts) != $null)
I do wish "truthiness" of various sorts were better defined in Kamailio.
-- Alex
Try:
if(defined $xavp(tm_contacts))
or:
if($xavp(tm_contacts) != $null)
Both of the above worked, Thanks!
I do wish "truthiness" of various sorts were better defined in Kamailio.
I don't quite follow what you mean here, but I probably agree with you. In particular for t_load_contacts() -
If the destination set contains only one branch, the function does nothing.
Function returns 1 if loading of contacts succeeded or there was nothing to do. In case of an error, function returns -1 (see syslog).
I guess in my mind it might be worthwhile to return a different return code if the destination set contains only one branch.
Thanks again.