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

Jock McKechnie jock.mckechnie at gmail.com
Tue Jan 25 22:59:17 CET 2011


On Tue, Jan 25, 2011 at 3:46 PM, Brett Nemeroff <brett at nemeroff.com> wrote:

> 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");
> }
>
>
I'll be bollocked, well done Brett!

Works like a charm, and all of my problems have evaporated.

Thanks muchly;

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


More information about the Users mailing list