I wouldn’t recommend trying to bypass the restriction in this way. Both the lua 
and python exec modules were designed to operate on a SIP message, which is why 
they can only be called from routes that process messages. Calling it from 
time_route where there is no message, even if you could get it to work, could 
have unexpected and unpleasant results.

>From LUA module doc for lua_exec: “Calls a Lua function with passing it the 
>current SIP message” [1].

[1] https://opensips.org/docs/modules/3.1.x/lua.html#idp5933680

Ben Newlin

From: Users <users-boun...@lists.opensips.org> on behalf of Johan De Clercq 
<jo...@democon.be>
Date: Thursday, December 3, 2020 at 6:55 AM
To: OpenSIPS users mailling list <users@lists.opensips.org>
Subject: Re: [OpenSIPS-Users] lua_exec in timer route - OpenSIPS 3.1
what you can try, is to call another route in the time route.
And then in that route, you execute the lua script.
maybe (just a myabe) that will work.

wkr,

Op do 3 dec. 2020 om 12:23 schreef Mark Allen 
<m...@allenclan.co.uk<mailto:m...@allenclan.co.uk>>:
Hi Johan

In the documentation for 3.1 lua module - TIMER_ROUTE is not one of the routes 
available to lua_exec. If I include it in a TIMER route, OpenSIPS fails to 
start with syntax error and the log error is:

    CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:265:19-20: 
Command <lua_exec> cannot be used in the block#012

If I move the lua_exec command into main route{ it works fine

I also encounter the problem running a cache_remove_chunk in a TIMER route 
although the documentation doesn't say that it's not valid for TIMER route. It 
fails on startup with the error:

    CRITICAL:core:yyerror: parse error in /etc/opensips/opensips.cfg:266:33-34: 
Command <cache_remove_chunk> cannot be used in the block#012

Again - if I run the command in main route{ the command works fine


cheers,

Mark

On Thu, 3 Dec 2020 at 11:01, Johan De Clercq 
<jo...@democon.be<mailto:jo...@democon.be>> wrote:
It for sure does not run in async mode.
Did you try executing a script in timer route ?
What's the output in the log ?

Op do 3 dec. 2020 om 11:56 schreef Mark Allen 
<m...@allenclan.co.uk<mailto:m...@allenclan.co.uk>>:
Is there a way to run a lua_exec from a timer route?
_______________________________________________
Users mailing list
Users@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________
Users mailing list
Users@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________
Users mailing list
Users@lists.opensips.org<mailto:Users@lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<http://lists.opensips.org/cgi-bin/mailman/listinfo/users>
_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to