Some extra details and examples, hopefully for better clarification of new people dealing with xavps.

To add an xavp, you must not use an index, like Alberto wrote:

$xavp(caller_peer=>accountname) = "Account Variable"; /*This is an example to add a value in an xavp */

Then to add an extra xavp inside the first root avp use index for the first name:

$xavp(caller_peer[0]=>accountname) = "AAA";

To overwrite first value in the first root xavp:

$xavp(caller_peer[0]=>accountname[0]) = "NEW AAA";

To overwrite first value in the first root xavp:

$xavp(caller_peer[0]=>accountname[1]) = "ABC";

Just have in mind, that when using an index it's about overwriting a previous value of an existing xavp, not adding a new xavp.

Cheers,
Daniel

On 28/11/2016 18:40, Alberto Llamas wrote:
Hello Linux,

Each xavp has a name and name values. So if you first define the name of the variable then you assign the name value it will work for you:

$xavp(caller_peer=>accountname) = "Account Variable"; /*This is an example*/
$xavp(caller_peer[0]=>accountname) = "AAA";
xlog("L_WARN", "XAVP ACCOUNT NAME $xavp(caller_peer[0]=>accountname) \n");


Regards,

On Mon, Nov 28, 2016 at 5:55 PM, Linux Vince <linuxv@gmail.com> wrote:
Hi,

I am sure i am doing something very basic wrongly.

Here is my config file snippet

$xavp(caller_peer[0]=>accountname) = "AAA";
xlog("L_WARN", "XAVP ACCOUNT NAME $xavp(caller_peer[0]=>accountname) \n");

No matter what i set this XAVP at, it always prints null in log file as below

WARNING: <script>: XAVP ACCOUNT NAME <null>

Please help how i can set XAVP and use it further in config file.

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users




--
Alberto Llamas
Phone: +1-786-805-6003
Telecommunications Engineer
Digium Certified Asterisk Professional (dCap)



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com