[SR-Users] Possibility of kemi lua to keep lua global vars
Daniel-Constantin Mierla
miconda at gmail.com
Thu Apr 26 08:47:57 CEST 2018
Hello,
have you look at the PID, is it done for the same process? Can you send
some sample syslog messages?
Also what is the version of your lua?
Cheers,
Daniel
On 25.04.18 07:15, Yuriy Gorlichenko wrote:
> Hi
> For now as I see: every request that calls lua script reevables my
> global lua variables
>
> For example
>
> I trying to connect to DB via luasql driver and checking if connection
> already existis to avoid new connection
>
> I have function init() that calls in ksr_request_route()
>
> Inside i have ome check:
>
> if not CON then
>
> CON =
> assert(MYSQL:connect(DBdata.dbname,DBdata.username,DBdata.password,DBdata.host,DBdata.port))
>
> if not CON then
> KSR.log("info","|init|log| DB NOT connected\n")
> KSR.sl.sl_send_reply(503,"Internal server error")
> KSR.x.exit()
> else
> KSR.log("info","|init|log| DB connected\n")
> end
> end
>
> So in this case if CON was already created it should not try to connect
>
> But for now it tries for every request. So means kemi not stores
> global lua variables between sessions (in one kamailio process)
>
> Also as I know INIT routes initiates before lua machine will be
> started so it not allowed to init some lua global variables in the
> init routes
>
> So my question is there is a way to keep global vars per kamailio
> process instead per kamailio request?
>
>
>
>
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla
www.twitter.com/miconda -- www.linkedin.com/in/miconda
Kamailio World Conference - May 14-16, 2018 - www.kamailioworld.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20180426/3db7b96a/attachment.html>
More information about the sr-users
mailing list