Hello,

this approach should work, maybe there are some errors in your python scripts, try to run with debug=3 in kamailio config and see if you get more debug messages around the error that could give some hints about what happens there.

Cheers,
Daniel

On 18.03.26 15:20, Dries De Gendt via sr-users 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 -- sr-users@lists.kamailio.org
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
-- 
Daniel-Constantin Mierla (@ asipto.com)
twitter.com/miconda -- linkedin.com/in/miconda
Kamailio Consultancy, Training and Development Services -- asipto.com
Kamailio World Conference, May 7-8, 2026 - Berlin, Germany -- kamailioworld.com