Hi,
Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)?
Marcin
Hello,
other people might be able to add more, but what you can certainly can do is to have a usual kamailio.cfg and then use e.g. lua_run(..) to execute some functions defined in the loaded lua script. In my opinion you will add some more complexity if you start to mix also the routes, but it might be fine for a certain migration period.
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-users sr-users-bounces@lists.kamailio.org On Behalf Of Marcin Kowalczyk Sent: Wednesday, October 21, 2020 7:25 PM To: sr-users@lists.kamailio.org Subject: [SR-Users] KEMI and Native mixing
Hi,
Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)?
Marcin
Hi,
Thanks for your reply. I have quite a large and complex kamailio.cfg and it would be quite a challenging task to migrate it in one go. This is the reason why I was thinking to do it block by block to be sure it will not break a logic.
Regards Marcin
On Wed, Oct 21, 2020 at 8:16 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
other people might be able to add more, but what you can certainly can do is to have a usual kamailio.cfg and then use e.g. lua_run(..) to execute some functions defined in the loaded lua script.
In my opinion you will add some more complexity if you start to mix also the routes, but it might be fine for a certain migration period.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Marcin Kowalczyk *Sent:* Wednesday, October 21, 2020 7:25 PM *To:* sr-users@lists.kamailio.org *Subject:* [SR-Users] KEMI and Native mixing
Hi,
Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)?
Marcin
Hi Marcin, As a bit addition to the above comments once you set cfgengine to your prefered lang the routes become the language's functions which should be defined, but you still can keep some "event-routes" in native kamailio language, they are being initialised at startup. If you migrate a large script, I'd suggest you split it into several logically or by route divided scripts, so by this way you can load/reload and troubleshoot them separately. Testing framework could be much help.
Regards,
On Thu, Oct 22, 2020 at 10:13 PM Marcin Kowalczyk marcin.kowalczyk@channels.app wrote:
Hi,
Thanks for your reply. I have quite a large and complex kamailio.cfg and it would be quite a challenging task to migrate it in one go. This is the reason why I was thinking to do it block by block to be sure it will not break a logic.
Regards Marcin
On Wed, Oct 21, 2020 at 8:16 PM Henning Westerholt hw@skalatan.de wrote:
Hello,
other people might be able to add more, but what you can certainly can do is to have a usual kamailio.cfg and then use e.g. lua_run(..) to execute some functions defined in the loaded lua script.
In my opinion you will add some more complexity if you start to mix also the routes, but it might be fine for a certain migration period.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Marcin Kowalczyk *Sent:* Wednesday, October 21, 2020 7:25 PM *To:* sr-users@lists.kamailio.org *Subject:* [SR-Users] KEMI and Native mixing
Hi,
Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)?
Marcin
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Hello,
adding a bit more on this topic: it should be also possible to execute native config routing blocks from KEMI using KSR.cfgutils.route_if_exists() or KSR.route().
Just test before when combining use of route or event_route (especially for this ones) from KEMI, to be sure that the conditions in the c code do not prevent execution of particular native config blocks when cfg engine is set to a KEMI interpreter. Open an issue on tracking whenever such case if found in order to be sorted out properly.
Cheers, Daniel
On 23.10.20 07:19, Arsen Semenov wrote:
Hi Marcin, As a bit addition to the above comments once you set cfgengine to your prefered lang the routes become the language's functions which should be defined, but you still can keep some "event-routes" in native kamailio language, they are being initialised at startup. If you migrate a large script, I'd suggest you split it into several logically or by route divided scripts, so by this way you can load/reload and troubleshoot them separately. Testing framework could be much help.
Regards,
On Thu, Oct 22, 2020 at 10:13 PM Marcin Kowalczyk marcin.kowalczyk@channels.app wrote:
Hi, Thanks for your reply. I have quite a large and complex kamailio.cfg and it would be quite a challenging task to migrate it in one go. This is the reason why I was thinking to do it block by block to be sure it will not break a logic. Regards Marcin On Wed, Oct 21, 2020 at 8:16 PM Henning Westerholt <hw@skalatan.de <mailto:hw@skalatan.de>> wrote: Hello, other people might be able to add more, but what you can certainly can do is to have a usual kamailio.cfg and then use e.g. lua_run(..) to execute some functions defined in the loaded lua script. In my opinion you will add some more complexity if you start to mix also the routes, but it might be fine for a certain migration period. Cheers, Henning -- Henning Westerholt – https://skalatan.de/blog/ <https://skalatan.de/blog/> Kamailio services – https://gilawa.com <https://gilawa.com/> *From:* sr-users <sr-users-bounces@lists.kamailio.org <mailto:sr-users-bounces@lists.kamailio.org>> *On Behalf Of *Marcin Kowalczyk *Sent:* Wednesday, October 21, 2020 7:25 PM *To:* sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> *Subject:* [SR-Users] KEMI and Native mixing Hi, Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)? Marcin _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org <mailto:sr-users@lists.kamailio.org> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users <https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users>
-- Arsen Semenov
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
It is not a big deal to use it with lua_run(). It will work without any double_trouble in general I do it a lot in many projects which are still in native lang but already need some extensions I would recommend you to test your Lua before set into production. Here is a test suite which can help you to protect yourself from some mistakes https://github.com/ovoshlook/kemi-lua-test-suite
ср, 21 окт. 2020 г. в 20:18, Henning Westerholt hw@skalatan.de:
Hello,
other people might be able to add more, but what you can certainly can do is to have a usual kamailio.cfg and then use e.g. lua_run(..) to execute some functions defined in the loaded lua script.
In my opinion you will add some more complexity if you start to mix also the routes, but it might be fine for a certain migration period.
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-users sr-users-bounces@lists.kamailio.org *On Behalf Of *Marcin Kowalczyk *Sent:* Wednesday, October 21, 2020 7:25 PM *To:* sr-users@lists.kamailio.org *Subject:* [SR-Users] KEMI and Native mixing
Hi,
Is it possible to mix both KEMI (lua) and Native configs in one kamailio instance? So some blocks are called from native script and some others from KEMI (lua)?
Marcin _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users