Am 01.10.2015 um 12:53 schrieb Daniel-Constantin Mierla: > there are different actions, one is assignment of an expression and the > other is a function call. Functions can evaluate they parameters as they > need/want by having the appropriate C code inside.
After I noticed the problem and tried to understand what was going on, that's what I came up with. That doesn't make it less error prone, however. > For assignments, that is the general interpreter which considers strings > as being the tokens in between quotes. Trying to interpret variables > inside the strings automatically won't work, because that will mean to > do it for cases when it should not happen (e.g., modparams or function > parameters that specify just name of variables). Of course, with some > extra coding to keep states of where that string is used might be > possible, but I think will make the interpreter too complex. I might be > wrong, so a patch is welcome to prove the otherwise :-) Ideally, all variables in double quoted strings should be interpolated and single quoted strings should not (the same way it is done in bash, Perl, PHP, Groove, Ruby and elsewhere). > Some functions can evaluate the parameter content, some don't. And in > some cases, even there is a variable inside a parameter for a function, > it is not evaluated, but it is set. That's again based on the purpose of > the function. That's frightening! > Instead of concatenation expression, you can use few other options: > - $_s(...) -- iirc, like: That $_() is a useful thing to know. > $var(x) = $_s("sip:+$var(abc)-$var(def)-$si@$Ri:$Rp"); > > - pv_printf($var(x), ...) I looked up the documentation for pv_printf() in the KEx module and was baffled to see the variable name being passed as a string in the example ... "pv_printf("$ru", "sip:$rU@$fd");" :-* Cheers, -Sven
signature.asc
Description: OpenPGP digital signature
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users