Hi Daniel,

it seems that your suggestion is not working, we are not using python for the whole script, we have some functions written in python to manipulate jsons and to do API queries which we keep in python but the core of the routing logic is still written in Kamailio scripting language.

We call the python functions with python_exec()

I tried to use both exit() and os.exit() but it looks like they are ignored and the route execution continues, the only thing that seems to work is to return 0 from the function

Can you tell me please if it is safe to use the return value to exit?

Thanks,
Enrico.


2018-03-28 16:35 GMT+02:00 Daniel-Constantin Mierla <miconda@gmail.com>:

Hello,

in Python you can call exit() or os.exit(), this throws an exception which is caught by Kamailio and interpreted as the usual exit from kamailio.cfg.

Probably we should add the KSR.x.exit() there as well, it was not added because python exit gave what was needed in this case

Cheers,
Daniel


On 27.03.18 16:49, Enrico Bandiera wrote:
Hello, I'm trying to use the KSR.x.exit() function in a KEMI python script but at runtime i get this error:

KSR.x.exit()
AttributeError: 'module' object has no attribute 'exit'

It seems that the exit function is missing even though it is documented.

My kamailio version is: kamailio 5.2.0-dev4 (x86_64/linux)  (it's a nightly)

Any idea on what I can do?

Thanks,
Enrico.


_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio Advanced Training - April 16-18, 2018, Berlin - www.asipto.com
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com