Hello,
On 02/22/2010 12:33 PM, Alex Balashov wrote:
Are AVP arrays still the only way to create a list of scalars as of K
3.0.0? Or are there other, more graceful ways to accommodate this
need now?
AVPs are a very useful feature, though the syntax is not documented in
'avpops' or the cookbook except rather incidentally:
$var(i) = 0;
while(is_avp_set("$(avp(s:somename)[$var(i)])")) {
xlog("L_INFO", "Value at index $var(i):
$(avp(s:somename)][$var(i)])\n");
$var(i) = $var(i) + 1;
}
Is there a better way to handle this now, perhaps via some features
imported from SER? Script variables ($var(...)) do not support
subscripts judging by the cookbook; do they?
no, they are single-value variables.
Are there other options I am unaware of?
There is no dedicated array type. In some cases you can use a hash table
and simulate an array by key value:
$var(i) = 0;
$sht(a=>[$var(i)]) = 1;
$var(i) = 1;
$sht(a=>[$var(i)]) = 2;
But it is only about how you define the keys, not a real array behind.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio SIP Router Masterclass, Berlin, March 22-26, 2010
* http://www.asipto.com/index.php/sip-router-masterclass/
_______________________________________________
Kamailio (OpenSER) - Users mailing list
Users@lists.kamailio.org
http://lists.kamailio.org/cgi-bin/mailman/listinfo/users
http://lists.openser-project.org/cgi-bin/mailman/listinfo/users