Will repeat reply here as sent it only to Daniel first

Yep. You understand right.

Here need to add some context then :-)

All my scripts "main.lua" ( that passed via *modparam* *load) *with cfg
engine lua starts as

*function initPath() *
*local myPath = debug.getinfo(1).source:match("@?(.*/)")*
*if not string.match(package.path, myPath) then*
*    package.path = myPath .. '?.lua;' .. package.path*
*end*
*KSR.log("debug","package path loaded: ".. **package.path) *
*end*

That I run as first step inside of all global functions like
*ksr_request_route() *and etc

This gives me possibility to load modules which lays at the subdirs near my
"*main.lua*" file that is kinda entry point

I can run it as global function too before others global function ofcourse,
but without *KSR.log()*

For .*cfg *files Where I use lua_run()  as extension I have the same
structure of lua modules and files and also run this function on the
main.lua for the same purpose *But  *at the main flow, not inside function
that Im calling via *lua_run() *

So accidently I started to run it at the main flow  but forgot to remove
*KSR.log()* and, actually, I expected to see
Lua error like "KSR not defined" or etc. But this gave me different error
that at the start of the topic and that confused me :-)

If need more clrification: I will be able to do it later on. Just let me
know.

On Wed, 18 Sep 2019, 08:44 Daniel-Constantin Mierla, <mico...@gmail.com>
wrote:

>
> On 16.09.19 21:08, Yuriy Gorlichenko wrote:
>
> I found issue:
> Called  KSR.log earlier than it was initiated.
> Moved part of code previously used in cfgengine "lua" to lua_run().
>
>
> Just to clarify: the issue was exposed because you moved some code that
> was used previously with cfgengine lua to a lua_run() usage? The KSR should
> be initialized quite early, that's why I am trying to figure out if there
> are cases when Lua code can be executed (due to some modparams or event
> routes) and the environment is not set, in order to find some solution for
> such cases. So if you can provide more details about how was used and not
> working, it may get fixes if it is a viable use case.
>
> Cheers,
> Daniel
>
>
>
> пн, 16 сент. 2019 г. в 15:25, Yuriy Gorlichenko <ovoshl...@gmail.com>:
>
>> Sorry Just a mistake. Offcourse it is path to kamailio.cfg file which
>> contains path to main.lua as modparam. Sorry for confusing
>>
>> On Mon, 16 Sep 2019, 10:45 Daniel-Constantin Mierla, <mico...@gmail.com>
>> wrote:
>>
>>> Hello,
>>>
>>> is it "kamailio -f /etc/kamailio/extended/main.lua" or just a typing
>>> mistake, because the config path provided with -f should still be to the
>>> kamailio.cfg where you set global parameters, load modules and set their
>>> parameters?
>>>
>>> Cheers,
>>> Daniel
>>>
>>> On Mon, Sep 16, 2019 at 7:23 AM Yuriy Gorlichenko <ovoshl...@gmail.com>
>>> wrote:
>>>
>>>> Hi! Im using kamailio 5.1.8 with app_lua and getting this message
>>>> during startup of kamailio. Looks like I forgot to add something at the
>>>> module setup, but cant figure out what is wrong. My setup of app_lua is:
>>>>
>>>> modparam("app_lua", "load", "/etc/kamailio/extended/main.lua")
>>>> modparam("app_lua","reload",1)
>>>> modparam("app_lua","register","textops")
>>>>
>>>> app_lua [app_lua_sr.c:1599]: sr_kemi_lua_exec_func_ex(): invalid Lua
>>>> environment attributes or parameters
>>>>
>>>> starting kamailio service with kamailio -f
>>>> /etc/kamailio/extended/main.lua
>>>>
>>>> Also here is little bit confusing me that in case of use "KSR"
>>>> everywhere I'm getting message about "sr"...
>>>>
>>>> Thx in advice
>>>> _______________________________________________
>>>> Kamailio (SER) - Users Mailing List
>>>> sr-users@lists.kamailio.org
>>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>
>>>
>>> --
>>> Daniel-Constantin Mierla - http://www.asipto.com
>>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>> _______________________________________________
>>> Kamailio (SER) - Users Mailing List
>>> sr-users@lists.kamailio.org
>>> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>>>
>>
> _______________________________________________
> Kamailio (SER) - Users Mailing 
> Listsr-users@lists.kamailio.orghttps://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
>
> --
> Daniel-Constantin Mierla -- www.asipto.comwww.twitter.com/miconda -- 
> www.linkedin.com/in/miconda
> Kamailio Advanced Training, Oct 21-23, 2019, Berlin, Germany -- 
> https://asipto.com/u/kat
>
>
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

Reply via email to