[sr-dev] New feature: #!ifexp - conditional preprocessor blocks

Alex Balashov abalashov at evaristesys.com
Thu Sep 15 12:18:20 CEST 2022


This is very exciting news - thank you Daniel!

> On Sep 15, 2022, at 5:37 AM, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> 
> Hello,
> 
> a new feature has landed to Kamailio devel version, bringing in more
> flexibility for preprocessing of the kamailio.cfg file.
> 
> It is about #!ifexp, which allows to evaluate an expression created with
> defined IDs, string and number values. Based on evaluation result, being
> true or false, parts of the config file can be enabled or disabled.
> 
> An extensive number of operators can be used in expressions, such as: +,
> -, *, /, ==, !=, <, >, <=, >=, ||, &&, etc. The evaluation is done using
> snexpr (https://github.com/miconda/snexpr), which was embedded inside
> Kamailio code.
> 
> Here are some simple kamailio.cfg examples:
> 
> #!ifexp KAMAILIO_VERSION >= 5006000
> loadmodule "tlsa.so"
> #!else
> loadmodule "tls.so"
> #!endif
> 
> #!ifexp MOD_xlog && (OS_NAME == "darwin")
> xlog("running on MacOS\n");
> #!endif
> 
> Documentation and more examples can be found on the wiki portal at:
> 
>   - https://www.kamailio.org/wikidocs/cookbooks/devel/core/#ifexp
> 
> Testing would be appreciated, feedback can be addressed to sr-users
> mailing list!
> 
> Cheers,
> Daniel
> 
> -- 
> Daniel-Constantin Mierla -- www.asipto.com
> www.twitter.com/miconda -- www.linkedin.com/in/miconda
> 
> 
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/




More information about the sr-dev mailing list