[SR-Users] Reload lua script?

Daniel-Constantin Mierla miconda at gmail.com
Fri Mar 30 09:41:32 CEST 2012


Hello,

On 3/29/12 3:15 PM, Javier Gallart wrote:
> Thanks Daniel
>
> On Thu, Mar 29, 2012 at 2:49 PM, Daniel-Constantin Mierla 
> <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>     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.
>
> Understood, we may give it a try in the next weeks.
>
>
>     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)
>
> I agree it's the most logical approach.
>
>     - 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, ...)
>
> Not sure either, will try.
>
> What about using luajit?
how to use it?

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120330/226347b9/attachment.htm>


More information about the sr-users mailing list