Hi!
I’m playing with new KEMI framework and trying to reload script without reloading Kamailio.
Lua code is mostly one from example.
... modparam("app_lua", "load", "/etc/kamailio/lua/kamailio.lua") cfgengine "lua" ...
So, I’m changing lua code and giving command
kamctl rpc app_lua.reload
But in the answer
{ "jsonrpc": "2.0", "error": { "code": -32000, "message": "Execution Error" }, "id": 11098 }
In syslog there is a string
/usr/sbin/kamailio[10939]: ERROR: app_lua [app_lua_api.c:399]: lua_sr_reload_script(): reload is not activated
What is need to be done to activate reload?
Regards, Igor
Kamailio version is kamailio 5.1.0-dev6
Regards, Igor
On Mar 13, 2018, 4:03 PM +0200, Igor Olhovskiy igorolhovskiy@gmail.com, wrote:
Maybe it’s due to errors in config (as syslog tells me), but according to doc, there is no errors
app_lua_run_ex(): error from Lua: /etc/kamailio/lua/kamailio.lua:394: attempt to call field 'has_body' (a nil value)
but ... if (KSR.textops.has_body()) then …
and module textops.so is loaded.
Regards, Igor
On Mar 13, 2018, 4:05 PM +0200, Igor Olhovskiy igorolhovskiy@gmail.com, wrote:
has_totag() is exported by siputils module, not by textops.
Cheers, Daniel
On 13.03.18 15:15, Igor Olhovskiy wrote:
5.1.0-dev6 is a development snapshot of v5.1.x, likely few months before having the full release out, with more new features.
You should update to latest stable version 5.1.2.
Cheers, Daniel
On 13.03.18 15:04, Igor Olhovskiy wrote:
For textops.
Seems textops module not exporting everything to Lua
app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.search(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.search_body(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.search_hf(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.is_present_hf(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.subst(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.subst_uri(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.subst_user(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.subst_body(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.subst_hf(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.remove_hf_re(...) app_lua [app_lua_sr.c:1961]: lua_sr_kemi_register_libs(): exporting KSR.textops.remove_hf_exp(...) app_lua [app_lua_sr.c:1975]: lua_sr_kemi_register_libs(): initializing kemi sub-module: KSR.textops (textops)
Regards, Igor
On Mar 13, 2018, 4:03 PM +0200, Igor Olhovskiy igorolhovskiy@gmail.com, wrote:
Again, wrote in previous response, if you are looking for has_totag(), you look at the wrong module.
However, regarding the exports, you are using a version during devel phase, upgrade to latest stable 5.1.x and you will get more exported functions.
On the other hand, for some of the functions related to string search/comparison, I put lower priority, because they can be done in the scripting language itself - Lua has more operations and functions for string handling that we have in our modules. I do not recall by heart right now if I exported all of them at the end, but there are more than you listed here in 5.1.2.
Cheers, Daniel
On 13.03.18 15:57, Igor Olhovskiy wrote:
It was has_body(), not has_totag()
Thanks for tip, will try to upgrade. This version was from debian repo.
Also missing quite needed function like ds_is_from_list
Regards, Igor
On Mar 14, 2018, 11:13 AM +0200, Daniel-Constantin Mierla miconda@gmail.com, wrote:
On 14.03.18 16:53, Igor Olhovskiy wrote:
It was has_body(), not has_totag()
Ohh, I misread...
Thanks for tip, will try to upgrade. This version was from debian repo.
Probably from debian repo for master branch, which meanwhile has kamailio 5.2.0-dev there.
Also missing quite needed function like ds_is_from_list
Stable branch releases 5.1.x should have it.
Cheers, Daniel
Hi!
Checked with 5.1.4 about ds_is_from_list
exporting KSR.dispatcher.ds_select(...) exporting KSR.dispatcher.ds_select_limit(...) exporting KSR.dispatcher.ds_select_domain(...) exporting KSR.dispatcher.ds_select_domain_limit(...) exporting KSR.dispatcher.ds_next_domain(...) exporting KSR.dispatcher.ds_select_dst(...) exporting KSR.dispatcher.ds_select_dst_limit(...) exporting KSR.dispatcher.ds_next_dst(...) initializing kemi sub-module: KSR.dispatcher (dispatcher) (8/24/261)
Seems no function for check if source in dispatcher table….
Also not mentioned here
https://www.kamailio.org/docs/tutorials/devel/kamailio-kemi-framework/module...
Regards, Igor
On Mar 14, 2018, 5:58 PM +0200, Daniel-Constantin Mierla miconda@gmail.com, wrote:
Hello,
indeed, I looked at code and ds_is_from_list is not exported. Do you need to use it with parameters or without?
Cheers, Daniel
On 15.03.18 15:55, Igor Olhovskiy wrote:
In most cases with parameter.
Regards, Igor
On Mar 16, 2018, 1:29 PM +0200, Daniel-Constantin Mierla miconda@gmail.com, wrote:
Hello,
On 13.03.18 15:03, Igor Olhovskiy wrote:
see the reload parameter for app_lua:
- https://kamailio.org/docs/modules/stable/modules/app_lua.html#app_lua.p.relo...
Cheers, Daniel