Hello,
of course, everything is possible to program somehow given enough effort. But your format would be difficult to support in Kamailio and in my opinion also quite sensitive to user failures.
Usually, Kamailio modules use the simple way of one assigning cfg parameter, or using a parsing helper symbol as shown in the htable example.
If there is a need for a more complex configuration, usually modules support a dedicated configuration file that provides more flexibility, like tls or dispatcher modules.
Cheers,
Henning
--
Henning Westerholt –
https://skalatan.de/blog/
Kamailio services –
https://gilawa.com
From: Вадим С via sr-dev <sr-dev@lists.kamailio.org>
Sent: Montag, 29. Januar 2024 17:35
To: sr-dev@lists.kamailio.org
Cc: Вадим С <vadim.saranov@gmail.com>
Subject: [sr-dev] Format of settings sets in config.
Hello dear developers!
I'm developing a module that can have several sets of similar connections. I see that some modules allow specifying a sequence of settings in one parameter through the symbol ";", as sample:
modparam("htable", "htable", "customer=>size=8;dbtable=customer;cols='dids,description';coldelim=';'")
or my example:
modparam("module", "module", "connection=>alice;id=aliceid;password=alicepwd;timeout=60;param=123")
modparam("module", "module", "connection=>bob;id=bobid;password=bobpwd;timeout=90;param=456")
I don't find it user friendly.
Can I offer users blocks with settings that should start with some parameter, for example "connection", as in the example:
modparam("module", "connection", "alice") # first block of settings
modparam("module", "id", "aliceid")
modparam("module", "password", "alicepwd")
modparam("module", "timeout", 60)
modparam("module", "param", 123)
modparam("module", "connection", "bob") # second block of settings
modparam("module", "id", "bobid")
modparam("module", "password", "bobpwd")
modparam("module", "timeout", 90)
modparam("module", "param", 456)
modparam("module", "connection", "john") # third block of settings
...
If you think that this is not compatible with the kamailio configuration ideology, I will give up my idea :)