Hello,
just to add one possible option, there is a small module “matrix” that provides a data structure that might be handy in this case.
https://www.kamailio.org/docs/modules/devel/modules/matrix.html
Of course it can be also done by serializing the data in a htable or similar.
Cheers,
Henning
From: Ben Kaufman <bkaufman@bcmone.com>
Sent: Sonntag, 17. September 2023 17:39
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Subject: [SR-Users] Multi-dimensional data in htable
What’s the best way to store multi-dimensional data within an htable? For example, storing an avp stack:
$avp(foo) = "first";
$avp(foo) = "second";
$sht(bar=>foo) = $avp(foo);
The result of which is that only $avp(foo[0]) is stored in the htable:
kamcmd htable.dump bar
{
entry: 2
size: 1
slot: {
{
name: bar
value: second
type: str
}
}
}
The htable documentation shows support for lists, but it doesn’t make clear if this is really usable outside of loading from a database, and looks like it’s short hand for managing/creating linked lists. The other option would be to simply serialize the data
before storing it in the htable – which is fine, I just want to be sure I’m not overlooking a more convenient method.
Regards,
Kaufman