<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <tt>Hi Pat,<br>
      <br>
      Are you sure the -1 index works for you? I just tested with an
      1.11 code and got:<br>
      <br>
      Oct 12 11:35:12 [29913] ERROR:core:replace_avp: Index with
      negative value<br>
      Oct 12 11:35:12 [29913] ERROR:core:pv_set_avp: Failed to replace
      avp<br>
      Oct 12 11:35:12 [29913] ERROR:core:do_assign: setting PV failed<br>
      <br>
      I don't think negative indexes were ever supported for AVPs.<br>
      <br>
      Are you sure you do not have a patch for 1.11 to allow negative
      values ?<br>
      <br>
      Regards,<br>
    </tt>
    <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
    <div class="moz-cite-prefix">On 12.10.2016 03:04, Pat Burke wrote:<br>
    </div>
    <blockquote
      cite="mid:cd746f68a1af900ee0b36437d54fa6c6@voxtelesys.com"
      type="cite">
      <title></title>
      <div class="iw_mail" dir="ltr">In OpenSIPS 1.11 you were able to
        use the index of -1 on AVP's to put items into an AVP as a FIFO
        instead of a LIFO.
        <div><br>
        </div>
        <div>Here is what I mean.</div>
        <div><br>
        </div>
        <div>$(avp(list)[-1]) = 1;</div>
        <div>$(avp(list)[-1]) = 2;<br>
          <div>$(avp(list)[-1]) = 3;</div>
          <div>
            <div>$(avp(list)[-1]) = 4;</div>
          </div>
          <div>
            <div>$(avp(list)[-1]) = 5;</div>
          </div>
          <div><br>
          </div>
          <div>this would result the values coming off as a FIFO</div>
          <div>$avp(list) is 1</div>
          <div>
            <div>$avp(list) = NULL;</div>
            <div>$avp(list) is 2</div>
          </div>
          <div>
            <div>$avp(list) = NULL;</div>
            <div>$avp(list) is 3</div>
          </div>
          <div>
            <div>$avp(list) = NULL;</div>
            <div>$avp(list) is 4</div>
          </div>
          <div>
            <div>$avp(list) = NULL;</div>
            <div>$avp(list) is 5</div>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>Just pushing the items onto the AVP creates a LIFO</div>
          <div>
            <div>$avp(list) = 1;</div>
            <div>
              <div>
                <div>$avp(list) = 2;</div>
              </div>
              <div>
                <div>$avp(list) = 3;</div>
              </div>
              <div>
                <div>$avp(list) = 4;</div>
              </div>
              <div>
                <div>$avp(list) = 5;</div>
              </div>
              <div>
                <div><br>
                </div>
              </div>
              <div>this would result the values coming off as</div>
              <div>$avp(list) is 5</div>
              <div>
                <div>$avp(list) = NULL;</div>
                <div>$avp(list) is 4</div>
              </div>
              <div>
                <div>$avp(list) = NULL;</div>
                <div>$avp(list) is 3</div>
              </div>
              <div>
                <div>$avp(list) = NULL;</div>
                <div>$avp(list) is 2</div>
              </div>
              <div>
                <div>$avp(list) = NULL;</div>
                <div>$avp(list) is 1</div>
              </div>
            </div>
          </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>So my question is how do I create a FIFO without having
            to keep an index to ensure that I am adding the item to the
            end.  When porting the code from 1.11 to 2.2 I get an error
            "ERROR:core:replace_avp: Index with negative value" when I
            use the -1.</div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div class="signature">
            <div style="font-family: arial, helvetica, sans-serif;
              font-size: 16px;"><span data-mce-style="color: #808080;
                font-family: arial,helvetica,sans-serif; font-size:
                11pt;" style="color: rgb(128, 128, 128); font-size:
                11pt;">Regards,</span></div>
            <div style="font-family: arial, helvetica, sans-serif;
              font-size: 16px;">
              <span data-mce-style="color: #808080; font-family:
                arial,helvetica,sans-serif; font-size: 11pt;"
                style="color: rgb(128, 128, 128); font-size: 11pt;"><strong>Pat
                  Burke</strong></span><br>
              <br>
              <div><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>