[Kamailio-Users] Storing nonscalar types (lists)
Daniel-Constantin Mierla
miconda at gmail.com
Wed Feb 24 17:24:21 CET 2010
Hello,
On 02/24/2010 02:01 PM, Henning Westerholt wrote:
> 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.
>
can the matrix be loaded only from db? I guess data is in shared memory.
Would be good to be able to set records from script as well.
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio SIP Router Masterclass, Berlin, March 22-26, 2010
* http://www.asipto.com/index.php/sip-router-masterclass/
More information about the Users
mailing list