[Kamailio-Users] Storing nonscalar types (lists)
Henning Westerholt
henning.westerholt at 1und1.de
Wed Feb 24 14:01:04 CET 2010
On Wednesday 24 February 2010, Daniel-Constantin Mierla wrote:
> > 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.
Hi Daniel, Hi Alex,
we've a simple and small module that implements a matrix like this:
+---+----+--------+
| A | B | result |
+---+----+--------+
| 1 | 9 | 2 |
| 2 | 69 | 1 |
| 2 | 13 | 3 |
+---+----+--------+
The matrix is read from a database and cached in memory, there is a FIFO
command that can be used to reload it. There is a query command that uses a
given A and B and stores the result in an AVP. If there is interest in this I
could try to merge this into the repository.
Cheers,
Henning
More information about the sr-users
mailing list