Never mind, I have found the solution,

instead of,

> KSR.async.task_group_route("replication_send", "rpl_send")


use this,

> getattr(KSR, 'async').task_group_route("replication_send", "rpl_send")


That's because *async* is a python keyword and should not be used as
variable or function name.

Thank you.

--
Muhammad Shahzad Shafi
Tel: +49 176 99 83 10 85


On Tue, Apr 14, 2026 at 2:38 AM M S <[email protected]> wrote:

> Hi,
>
> I am trying to use *async* module functions in Python KEMI on Debian 13
> with kamailio version 5.8.8,
>
> Here is an example,
>
> KSR.async.task_group_route("replication_send", "rpl_send")
>
>
> However, it throws following exception,
>
> kamailio[2927480]: ERROR: app_python3 [python_support.c:167]:
>> python_handle_exception(): mod_init: Unhandled exception in the Python
>> code:
>>   File "/etc/kamailio/kemi.py", line 904
>>     KSR.async.task_group_route("replication_send", "rpl_send")
>>         ^^^^^
>> SyntaxError: invalid syntax
>
>
> This function works in kamailio.cfg but not in KEMI, even though it is
> documented at,
>
> https://kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/modules/#ksrasynctask_group_route
>
> Note: I tried to use other functions of same module and get similar error.
>
> What is correct syntax to use this module's functions in KEMI Python?
> Please suggest.
>
> Thank you.
>
> --
> Muhammad Shahzad Shafi
> Tel: +49 176 99 83 10 85
>
>
__________________________________________________________
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!

Reply via email to