[SR-Users] Variable interpolation in xavp identifiers

Alex Balashov abalashov at evaristesys.com
Wed Apr 1 00:35:34 CEST 2015


There seems to be an implementational difference in interpolation of PVs 
in AVP and XAVP identifiers and/or field names.

The pseudovariables documentation[1] on classical AVPs says:

    The 'id' can be:


       pseudo variable - if value of pv is integer, id is integer,
       if string, id is string

So, for example, this composition of variables works:

    $var(f) = 'donkey';
    $avp($var(f) = 'eehaw';

    xlog("L_INFO", "Donkey says: $avp(donkey)\n");

It correctly prints:

    Donkey says: eehaw

Making some assumptions, I tried this, and it did not work similarly as 

    $var(f) = 'donkey';
    $xavp(r=>$var(f)) = 'eehaw';

    xlog("L_INFO", "Donkey says: $xavp(r=>donkey)\n");

This prints:

    Donkey says: <null>

And a PV dump confirms that the PV value is not interpolated:

Mar 31 18:26:15 localhost /usr/local/sbin/kamailio[2399]: INFO: debugger 
[debugger_api.c:1799]: dbg_dump_json(): {"$xavp(r)":[{"$var(f)":["eehaw"]}]}

Interpolation of variables does not work for either field or stem names.

Is this a design principle of XAVPs, or an oversight?


-- Alex


Alex Balashov | Principal | Evariste Systems LLC
303 Perimeter Center North, Suite 300
Atlanta, GA 30346
United States

Tel: +1-800-250-5920 (toll-free) / +1-678-954-0671 (direct)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/

More information about the sr-users mailing list