<div dir="ltr">I confirmed that the issue was the missing return values for ksr_dialog_event() and ksr_htable_event(). Once added the exception errors no longer occur. Thanks for the help.<div><br></div><div>Cheers</div><div>Mike</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 18 Jun 2018 at 21:26, Michael Loughrey <<a href="mailto:mgloughrey@gmail.com">mgloughrey@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><font face="arial, helvetica, sans-serif">Thanks for the tip Anthony. I do indeed have a couple of ksr_ routines returning no value.</font><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">From kamailio.cfg</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div>
<pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial">####### Routing Logic ########<br></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin:0px;word-wrap:break-word;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">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"
</pre>
</font></pre></div><div><font face="arial, helvetica, sans-serif">In routing.py</font></div><div>
<pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;word-wrap:break-word;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"><br></font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;word-wrap:break-word;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"> ksr_dialog_event(self,msg,evname)</font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;word-wrap:break-word;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"> ksr_htable_event(self,msg,evname)</font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"><br></font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif">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
<pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin:0px;word-wrap:break-word;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial">KSR.tm.t_on_failure</pre>
is the equivalent to exit & drop.</font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif"><br></font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif">Cheers</font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><font face="arial, helvetica, sans-serif">Mike</font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;display:block;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><br></pre><font face="Courier New, Courier, monospace, arial, sans-serif">
</font><pre class="m_-8227684083186547353gmail-a-b-r-La" style="font-family:"Courier New",Courier,monospace,arial,sans-serif;display:block;margin:0px;word-wrap:break-word;text-decoration-style:initial;text-decoration-color:initial">ksr_dialog_event</pre><font face="Courier New, Courier, monospace, arial, sans-serif">
<br></font></pre><pre class="m_-8227684083186547353gmail-a-b-r-La" style="display:block;font-family:"Courier New",Courier,monospace,arial,sans-serif;margin:0px;white-space:pre-wrap;word-wrap:break-word;background-color:rgb(255,255,255);color:rgb(0,0,0);font-size:14px;text-align:left;text-decoration-style:initial;text-decoration-color:initial"><br></pre>
<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, 18 Jun 2018 at 20:10, Anthony Alba <<a href="mailto:ascanio.alba7@gmail.com" target="_blank">ascanio.alba7@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
On Mon, Jun 18, 2018 at 12:05:34PM -0400, Michael Loughrey wrote:<br>
> <br>
> <br>
> kamailio[2242]: 8(2253) ERROR: app_python [python_support.c:150]:<br>
> python_handle_exception(): python_exec2: Unhandled exception in the Python<br>
> code:<br>
> kamailio[2242]: TypeError: an integer is required<br>
> <br>
<br>
Hi Michael,<br>
<br>
This is usually a symptom of a ksr_* method having a code path which exits<br>
the function without returning an integer value (1 for success, 0 for immediate<br>
exit, and < 0 for failure) — the equivalent of a None return value. That might<br>
be the cause of the TypeError.<br>
<br>
Can you ensure that all your ksr_* methods have an integer return value no<br>
matter how they return.<br>
<br>
If this doesn't work, are you able to share your routing script?<br>
<br>
Regards<br>
<br>
Anthony<br>
<br>
_______________________________________________<br>
Kamailio (SER) - Users Mailing List<br>
<a href="mailto:sr-users@lists.kamailio.org" target="_blank">sr-users@lists.kamailio.org</a><br>
<a href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a><br>
</blockquote></div>
</blockquote></div>