[SR-Users] python_exec return 0 causes script hangs; return -1 is treated like 0

Anthony Alba ascanio.alba7 at gmail.com
Thu Feb 15 10:28:17 CET 2018


5.1.1: if python_exec method returns 0, then the script hangs

If the python_exec method return -1, then expressions treat it as if
it returned zero.

Somewhere there seems to be an offset by 1 issue.

 if (!python_exec("method")) {
   # if you return -1, the script does not hang but treated like zero
}

##################
Example 1:
class kamailio(object):
    def hello(self, msg):
        KSR.info("hello, world\n")
        return 0

Calling:  python_exec("hello")

will cause script hang

###################
Example 2:
class kamailio(object):
    def hello(self, msg):
        KSR.info("hello, world\n")
        return -1

Calling  python_exec("hello")

                if (!python_exec("hello")) {
                        ## method returns -1
                        ## why did we get here?
                        xlog("L_INFO","method return zero!\n");
                }


shows INFO: <script>: method return zero!



More information about the sr-users mailing list