[OpenSIPS-Users] OpensSIPS 2.2 - avps with an index of -1
Pat Burke
pat at voxtelesys.com
Wed Oct 12 02:04:19 CEST 2016
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.
Here is what I mean.
$(avp(list)[-1]) = 1;
$(avp(list)[-1]) = 2;
$(avp(list)[-1]) = 3;
$(avp(list)[-1]) = 4;
$(avp(list)[-1]) = 5;
this would result the values coming off as a FIFO
$avp(list) is 1
$avp(list) = NULL;
$avp(list) is 2
$avp(list) = NULL;
$avp(list) is 3
$avp(list) = NULL;
$avp(list) is 4
$avp(list) = NULL;
$avp(list) is 5
Just pushing the items onto the AVP creates a LIFO
$avp(list) = 1;
$avp(list) = 2;
$avp(list) = 3;
$avp(list) = 4;
$avp(list) = 5;
this would result the values coming off as
$avp(list) is 5
$avp(list) = NULL;
$avp(list) is 4
$avp(list) = NULL;
$avp(list) is 3
$avp(list) = NULL;
$avp(list) is 2
$avp(list) = NULL;
$avp(list) is 1
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.
Regards,
Pat Burke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20161011/b40f88ad/attachment.htm>
More information about the Users
mailing list