Re: Replacing certain route blocks with KEMI scripts
Alex Balashov via sr-users <[email protected]> Wed, 18 Mar 2026 11:27:04 -0400
| Newsgroups | gmane.comp.voip.ser |
|---|---|
| Message-ID | <[email protected]> |
Hi, IMHO, you would be better off doing this as classic inline Python (e.g. via app_python3), rather than via KEMI. Cheers, -- Alex > On Mar 18, 2026, at 10:20 AM, Dries De Gendt via sr-users <[email protected]> wrote: > > Hi, > > I was wondering if it is possible of keeping the request_route as native configuration, while replacing certain route blocks such as AUTH/REGISTRAR with python KEMI instead? > > The idea is to implement RFC8898, which basically requires me to challenge for bearer token and validate it afterwards if returned by the client. For my convencience, I had defined the AUTH and REGISTRAR block in python KEMI, and was calling them as such: > > request_route { > ... > > $var(auth_route_ret) = python_exec("ksr_route_auth", "test\n"); > xlog("$var(debug_level)", "[KSR_AUTH] Return code Kamailio is $var(auth_route_ret)"); > if ($var(auth_route_ret) == -255) { > exit; > } > > ... > $var(registrar_route_ret) = python_exec("ksr_route_registrar", "test\n"); > xlog("$var(debug_level)", "[KSR_REGISTRAR] REGISTRAR return code Kamailio is $var(registrar_route_ret)"); > if ($var(registrar_route_ret) == -255) { > exit; > } > ... > > } > > While the register itself seems to work, it seems that other blocks seem to fail as they would likely expect KSR? > > ERROR: {1 112367482 INVITE f0af27cd-9d75-123f-79a9-b4e9b8034b4e} <core> [core/kemi.c:3772]: sr_kemi_cbname_lookup_idx(): index 1 is out of range > > Any idea if this would be possible, or should I determine wether to go native cfg or KEMI? > > Best regards, > Dries > __________________________________________________________ > Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected] > To unsubscribe send an email to [email protected] > Important: keep the mailing list in the recipients, do not reply only to the sender! -- Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com, https://www.csrpswitch.com Tel: +1-706-510-6800 __________________________________________________________ Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected] To unsubscribe send an email to [email protected] Important: keep the mailing list in the recipients, do not reply only to the sender!