I think I looked at it several years ago and the situation is a bit complex given the way the config script interpreter is doing the evaluation -- there are the rules that return 0 means exit, negative values are evaluated to false and positive to true. Because of these, at different layers, the actual return values are lost and only the equivalent of true/false in C are propagated. I would not go myself in doing it, it doesn't bring much without large impact in the code -- the alternative is quite simple:
func();
if($rc == y) {
}
Also, if one wants to use the other scripting laguages like Lua, Python, JavaScript starting with v5.0 (through so called kemi framework), this is practically there already. The exported functions to kemi are not in pair with what's in kamailio.cfg native interpreter, but I hope to have it in pair for next v5.1. Also, the JS module app_jsdt doesn't have any external dependency, we embed its interpreter and that is practically only the ECMA script language, so the basics of the scripting languages (defining functions, executing them and the support for variables and expressions/statements, plus core language operations on numbers, lists/arrays and string values).
Cheers, Daniel
On 08.04.17 12:01, Juha Heinanen wrote:
I noticed that function result cannot be directly tested in if-statement:
if (func_x() == y) ...
Why is that? Should I open a feature request or is it a no-go?
-- Juha