[sr-dev] git:master:d11a1250: core: added selval(evalexpr, valexp1, valexpr2)

Olle E. Johansson oej at edvina.net
Tue Feb 9 07:30:15 CET 2021


Thank you Daniel for adding this function!

It wlil be really useful.

/O

> On 8 Feb 2021, at 11:24, Daniel-Constantin Mierla <miconda at gmail.com> wrote:
> 
> Module: kamailio
> Branch: master
> Commit: d11a12502299bf7e6f85505c4b48a4486a647e31
> URL: https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31
> 
> Author: Daniel-Constantin Mierla <miconda at gmail.com>
> Committer: Daniel-Constantin Mierla <miconda at gmail.com>
> Date: 2021-02-08T11:23:46+01:00
> 
> core: added selval(evalexpr, valexp1, valexpr2)
> 
> - this is a core statement that return the 2nd parameter if the 1st
> parameter is evaluated to true, or 3rd parameter if the 1st parameter is
> evaluated to false!
> - it can be considered a core function that is equivalent of ternary
> condition/operator
> - example:
>  $var(x) = selval($Ts mod 2, "true/" + $ru, "false/" + $rd);
> - the first parameter is a conditional expression, like those used for
> IF, the 2nd and 3rd parameters can be expressions like those used in the
> right side of assignments
> 
> ---
> 
> Modified: src/core/cfg.lex
> Modified: src/core/cfg.y
> Modified: src/core/rvalue.c
> Modified: src/core/rvalue.h
> 
> ---
> 
> Diff:  https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31.diff
> Patch: https://github.com/kamailio/kamailio/commit/d11a12502299bf7e6f85505c4b48a4486a647e31.patch
> 
> 
> _______________________________________________
> Kamailio (SER) - Development Mailing List
> sr-dev at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev




More information about the sr-dev mailing list