<head><title></title></head>
<body><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></body>