Greetings all;<br><br>I have a feeling I'm "almost there, but not quite" with this one, I was wondering if someone can point out the missing piece of my puzzle here.<br><br>I'm attempting to index an AVP with another AVP, which works just fine in OpenSIPS, but I'm attempting to seed the initial AVP array from an exec'd perl routine. Problem is, I'm not sure if the perl AVP routines can actually address indexed AVPs...<br>
<br>My perl looks (vaguely) like this:<br><br>my $idx = 0;<br>while(my $Data = &Get_Data) {<br> OpenSIPS::AVP::add("MAGIC[$idx]", "$Data");<br> $idx++;<br>}<br><br>Which I discovered I can access like this:<br>
xlog("L_INFO", "Displaying index 0: $avp(s:MAGIC[0])\n");<br><br>Note the position the [0] index - according to all the documentation it _should_ look like this: $(avp(s:MAGIC)[0]). This leads me to believe that the AVP name is being set, literally, to "MAGIC[0]" rather than a "MAGIC" array, per se.<br>
<br>I'm then trying to access the AVP later with an index inside another AVP, like so:<br>$avp(s:IDX) = 0;<br>xlog("L_INFO", "A index 0: $avp(s:MAGIC[$avp(s:IDX)])\n");<br>
xlog("L_INFO", "B index 0: $(avp(s:MAGIC)[$avp(s:IDX)])\n");<br>
<br>Both of which return a <null>. The former because I don't think you can insert a string into an AVP name in the manner I'm (accidentally) doing, and the latter because MAGIC it isn't an array like it should be.<br>
<br>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()?<br>
<br>Thanks!<br><br> - Jock<br>