[OpenSIPS-Users] Indexing AVPs with other AVPs... set from perl

Brett Nemeroff brett at nemeroff.com
Tue Jan 25 22:46:41 CET 2011


On Tue, Jan 25, 2011 at 3:41 PM, Jock McKechnie
> I'm then trying to access the AVP later with an index inside another AVP,
> like so:
> $avp(s:IDX) = 0;
> xlog("L_INFO", "A index 0: $avp(s:MAGIC[$avp(s:IDX)])\n");
> xlog("L_INFO", "B index 0: $(avp(s:MAGIC)[$avp(s:IDX)])\n");
>
> What's the appropriate way of doing this? Can I mangle the AVP name and
> simply have a list of several named AVPs rather than using the array feature
> - or is there a way of access the indices from the OpenSIPS::AVP::add()?


Hello Jock,
Just a thought. I imagine that the add method in the perl libs
probably work just like the add commands from the script. Have you
tried just omiting the index entirely? From what I understand, it
works a little more like you'd expect "push" to.

So maybe:
while(my $Data = &Get_Data) {
  OpenSIPS::AVP::add("MAGIC", "$Data");
}



More information about the Users mailing list