On Fri, Mar 4, 2016 at 9:19 AM, Abaci B <abaci64@gmail.com> wrote:
The question is not how to figure out when to exit the lua script, the question is *how to exit the lua script*, and that can sometimes be tricky or complicated as return "exit" only works from hangup hook.
Are you positive that it works only from a hangup hook? It seems to work at the end of any loop: -- testing exit (no session, call with luarun) freeswitch.consoleLog('INFO',"Starting infinite loop...\n") while(1) do freeswitch.consoleLog('WARNING',"Before exit...\n") return "exit" end freeswitch.consoleLog('INFO',"All done!\n") Or with a session: -- test exit with session, no hangup hook session:answer() freeswitch.consoleLog('INFO',"Entering main loop...\n") while ( session:ready() == true ) do freeswitch.consoleLog('WARNING',"Inside loop...\n") return "exit" end freeswitch.consoleLog('INFO',"All done!\n") In both cases I never see "All done!" at the CLI. Can you try it and see if there's a scenario where it does not exit as expected? -MC