[SR-Users] KEMI routing script Python exceptions with empty traceback

Michael Loughrey mgloughrey at gmail.com
Tue Jun 19 03:26:58 CEST 2018


Thanks for the tip Anthony. I do indeed have a couple of ksr_ routines
returning no value.

>From kamailio.cfg

####### Routing Logic ########

modparam("xhttp", "event_callback", "ksr_xhttp_event")
modparam("htable", "event_callback_mode", 1)
modparam("htable", "event_callback", "ksr_htable_event")
modparam("dialog", "event_callback", "ksr_dialog_event")
modparam("app_python", "load", "/usr/local/etc/kamailio/routing.py")
cfgengine "python"

In routing.py


   ksr_dialog_event(self,msg,evname)

   ksr_htable_event(self,msg,evname)


are not returning values. I will correct these to always return 1.
Hopefully that resolves the issue. Could you confirm that a return
value of 0 from routes such as those set in


KSR.tm.t_on_failure

is the equivalent to exit & drop.


Cheers

Mike


ksr_dialog_event





On Mon, 18 Jun 2018 at 20:10, Anthony Alba <ascanio.alba7 at gmail.com> wrote:

>
> On Mon, Jun 18, 2018 at 12:05:34PM -0400, Michael Loughrey wrote:
> >
> >
> > kamailio[2242]:  8(2253) ERROR: app_python [python_support.c:150]:
> > python_handle_exception(): python_exec2: Unhandled exception in the
> Python
> > code:
> > kamailio[2242]: TypeError: an integer is required
> >
>
> Hi Michael,
>
> This is usually a symptom of a ksr_* method having a code path which exits
> the function without returning an integer value (1 for success, 0 for
> immediate
> exit, and < 0 for failure) — the equivalent of a None return value. That
> might
> be the cause of the TypeError.
>
> Can you ensure that all your ksr_* methods have an integer return value no
> matter how they return.
>
> If this doesn't work, are you able to share your routing script?
>
> Regards
>
> Anthony
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180618/7e56d5f1/attachment.html>


More information about the sr-users mailing list