[SR-Users] kamctl or kamcmd way to enable/disable sections of configs

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 17 08:53:32 CET 2022

The defines are preprocessor directives, therefore they are evaluated at
start-up, before parsing the configuration file. Practically, those
parts not enabled at start up are not seen by kamailio config
interpreter at runtime, they cannot be enabled because they don't exist
in memory.

The solution here is to use shared memory variables, like:

if($shv(enabled)==1) {



The value of $shv(enabled) can be changed with rpc commands using


On 16.03.22 15:29, Joshua Young wrote:
> #!define MYSECTION"
>     route("1");
>     #!ifdef MYSECTION
>     route("2");
>     #!endif
> I have declarations like this in my kamailio.cfg file, and was curious
> if there was a way to use kamctl or kamcmd to enable or disable the
> defined value in a live system. Or if there is another
> approach/mechanism I'm unaware of the "Serial Forking Based on Q
> Value" stuff and use it in other parts, but I am looking for a general
> way to manually manipulate routing on live system using cli commands
> if possible...
> Thanks,
> Joshua
> __________________________________________________________
> Kamailio - Users Mailing List - Non Commercial Discussions
>   * sr-users at lists.kamailio.org
> Important: keep the mailing list in the recipients, do not reply only to the sender!
> Edit mailing list options or unsubscribe:
>   * https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Daniel-Constantin Mierla -- www.asipto.com
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - Online
  March 28-31, 2022 (Europe Timezone)
  * https://www.asipto.com/sw/kamailio-advanced-training-online/

More information about the sr-users mailing list