[OpenSIPS-Users] OpensSIPS 2.2 - avps with an index of -1

Bogdan-Andrei Iancu bogdan at opensips.org
Wed Oct 12 10:46:56 CEST 2016


Hi Pat,

Are you sure the -1 index works for you? I just tested with an 1.11 code 
and got:

Oct 12 11:35:12 [29913] ERROR:core:replace_avp: Index with negative value
Oct 12 11:35:12 [29913] ERROR:core:pv_set_avp: Failed to replace avp
Oct 12 11:35:12 [29913] ERROR:core:do_assign: setting PV failed

I don't think negative indexes were ever supported for AVPs.

Are you sure you do not have a patch for 1.11 to allow negative values ?

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 12.10.2016 03:04, Pat Burke wrote:
> 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*
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20161012/e93bbeab/attachment.htm>


More information about the Users mailing list