Hello,
On 3/29/12 11:49 AM, Javier Gallart wrote:
Hello all
I'm starting to play with lua scripting in Kamailio. It's really cool,
some complex stuff in the script becomes really easy this way. The
script is becoming quite big, therefore I'd like to use lua_run
instead of lua_dofile. My doubt is pretty basic: if i load a script
in memory at startup via the "load" parameter and the script is
modifed afterwards, is there any way to reload the module so the
script is reread?
the two contexts created by app_lua were designed one for loading
at
startup and the other for reloading every time. Reloading on demand at
runtime is not possible. I thought of checking the timestamp of the
script, but can be a bit risky if saving on intermediary state during
updates. The scripts are loaded in each process, sending a mi/rpc
command will require to do some inter-process signaling. Both doable,
not in my short term plans, though, if someone is contributing, will be
appreciated.
Some options for speed up with existing code:
- you can compile the Lua scripts, so reloading it each time will be
faster (no more compile on-the-fly)
- not sure about this one: in your script loaded at startup you may have
some logic to load another script based on your rules (e.g., file
timestamp, periodically, ...)
Cheers,
Daniel
--
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/