<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Some extra details and examples, hopefully for better
      clarification of new people dealing with xavps.</p>
    <p>To add an xavp, you must not use an index, like Alberto wrote:<br>
    </p>
    $xavp(caller_peer=>accountname) = "Account Variable"; /*This is
    an example to add a value in an xavp */<br>
    <br>
    Then to add an extra xavp inside the first root avp use index for
    the first name:<br>
    <br>
    $xavp(caller_peer[0]=>accountname) = "AAA";<br>
    <br>
    To overwrite first value in the first root xavp:<br>
    <br>
    $xavp(caller_peer[0]=>accountname[0]) = "NEW AAA";<br>
    <br>
    To overwrite first value in the first root xavp:<br>
    <br>
    $xavp(caller_peer[0]=>accountname[1]) = "ABC";<br>
    <br>
    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.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 28/11/2016 18:40, Alberto Llamas
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAHH1jkPzDt-SQQCkRQQeb1JC=q32TPT0wMqyfVMrVjXgy9m+1Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hello Linux,
        <div><br>
        </div>
        <div>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:</div>
        <div><br>
        </div>
        <div><span style="font-size:12.8px">$xavp(caller_peer=></span><wbr
            style="font-size:12.8px"><span style="font-size:12.8px">accountname)
            = "Account Variable"; <b>/*This is an example*/</b></span><br>
        </div>
        <div>
          <div style="font-size:12.8px">$xavp(caller_peer[0]=><wbr>accountname)
            = "AAA";<br>
          </div>
          <div style="font-size:12.8px">xlog("L_WARN", "XAVP ACCOUNT
            NAME $xavp(caller_peer[0]=><wbr>accountname) \n");</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Regards,</div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Nov 28, 2016 at 5:55 PM, Linux
          Vince <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:linuxv@gmail.com" target="_blank">linuxv@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Hi,
              <div><br>
              </div>
              <div>I am sure i am doing something very basic wrongly.</div>
              <div><br>
              </div>
              <div>Here is my config file snippet</div>
              <div><br>
              </div>
              <div>$xavp(caller_peer[0]=><wbr>accountname) = "AAA";<br>
              </div>
              <div>xlog("L_WARN", "XAVP ACCOUNT NAME
                $xavp(caller_peer[0]=><wbr>accountname) \n");<br>
              </div>
              <div><br>
              </div>
              <div>No matter what i set this XAVP at, it always prints
                null in log file as below</div>
              <div><br>
              </div>
              <div>WARNING: <script>: XAVP ACCOUNT NAME
                <null><br>
              </div>
              <div><br>
              </div>
              <div>Please help how i can set XAVP and use it further in
                config file.</div>
            </div>
            <br>
            ______________________________<wbr>_________________<br>
            SIP Express Router (SER) and Kamailio (OpenSER) - sr-users
            mailing list<br>
            <a moz-do-not-send="true"
              href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
            <a moz-do-not-send="true"
              href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
              rel="noreferrer" target="_blank">http://lists.sip-router.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
            <br>
          </blockquote>
        </div>
        <br>
        <br clear="all">
        <div><br>
        </div>
        -- <br>
        <div class="gmail_signature" data-smartmail="gmail_signature">
          <div dir="ltr">
            <div>
              <div dir="ltr">
                <div dir="ltr">
                  <div dir="ltr">
                    <div>Alberto Llamas<br>
                    </div>
                    <div>Phone: +1-786-805-6003</div>
                    <div>
                      <div dir="ltr">
                        <div name="div[0]"><span>Telecommunications</span><span>
                          </span><span>Engineer</span></div>
                      </div>
                      Digium Certified Asterisk Professional (dCap)</div>
                    <div><br>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>