<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 8, 2016, at 12:11 PM, Abaci B &lt;<a href="mailto:abaci64@gmail.com" class="">abaci64@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="">So after spending more time testing all the options here is what I found.</div><div class=""><br class=""></div><div class=""><font face="monospace,monospace" class="">return "exit"</font> and <font face="monospace,monospace" class="">return "die"</font> will exit the script when called from the hangup hook but not when called from within any other function.</div></div></div></blockquote><div><br class=""></div><div>This is expected. &nbsp;We only look for those results on return from hangup hook, this is by design.</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><font face="monospace,monospace" class="">session:destroy()</font> will only work from the hangup hook but it crashes FreeSWITCH (master from 10 days ago) with error: "<font face="monospace,monospace" class="">freeswitch: src/switch_channel.c:1421:</font></div></div></div></div></blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><font face="monospace,monospace" class="">switch_channel_set_variable_var_check: Assertion `channel != ((void *)0)' failed.</font><font face="monospace,monospace" class="">"</font> I will open a Jira for that.</div></div></div></div></blockquote><div><br class=""></div><div><br class=""></div><div><div>You shouldn't need to or want to call session:destroy on the session running the script, although this should be a no-op or force hangup in this case, not crash. &nbsp;Please file a jira for this issue, but i can confirm that you would never want to actually do this.</div></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">From the main body of a lua script (not within a function) any return will exit the script (e.g. <font face="monospace,monospace" class="">return "blah"</font> would also exit);</div></div></div></blockquote><div><br class=""></div><div>Expected behavior, yes</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">Calling <font face="monospace,monospace" class="">error()</font> would work from any place except for hangup hook.</div></div></div></blockquote><div><br class=""></div><div>I would expect calling error to work, not sure why it isn't from hangup hook, we should look at that (although it can be easily worked around by just doing return in the hangup hook)</div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="">So while it would have been nice to have one method that works everywhere, at least there is a way to do it wherever you are in the code.</div><div class=""><br class=""></div><div class="">Can someone please document this on the lua wiki so that others can save the time figuring it out, or should I open a Jira for that also?</div></div></div></blockquote><div><br class=""></div>Lets get these issues fixed first?</div><div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jul 7, 2016 at 8:17 PM, Michael Jerris <span dir="ltr" class="">&lt;<a href="mailto:mike@jerris.com" target="_blank" class="">mike@jerris.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Just returning a value from any random function won't have any effect.&nbsp; The return from hangup hook is special as thats a function we call from the c code.&nbsp; Its probably possible to add a method that you could run that would terminate the script, but I don't think there is any way to do that currently.&nbsp; On quick review, it looks like the way "exit" return from hangup hook is implemented is by way of calling&nbsp;<span style="color:rgb(191,191,191);font-family:Monaco;font-size:13px;background-color:rgb(0,0,0)" class="">lua_error</span>&nbsp;from the c code, which would cause the script to terminate.&nbsp; Other than that, as was said above, the way to end a script is by way of returning from the body of it.<div class=""><div class="h5"><div class=""><br class=""><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jul 7, 2016, at 7:20 PM, Abaci B &lt;<a href="mailto:abaci64@gmail.com" target="_blank" class="">abaci64@gmail.com</a>&gt; wrote:</div><br class=""><div class=""><div dir="ltr" class=""><div class="">I just got around to test this again and here is what I found.</div><div class="">from within the hangup hook you can exit using <font face="monospace,monospace" class="">return "exit"</font> and as noted by Andrew it will exit with an error unless you set <font face="monospace,monospace" class="">debug.traceback=nil</font></div><div class="">from the main code (not within a function) you can exit by using <font face="monospace,monospace" class="">return "exit"</font> (or return anything else) which is just lua exiting but it has to be at the end of a block (wither a loop or you can just <font face="monospace,monospace" class="">return "exit" end</font>).</div><div class="">from within a function there seems to be no way to exit the lua script, for scripts that are session based you can probably use <font face="monospace,monospace" class="">session:hangup()</font> along with calling <font face="monospace,monospace" class="">return "exit"</font> from the hangup hook, but on any other lua scripts (api, event hooks, dialplan hook, startup) there seems to be no way.</div><div class="">So my question is if anyone know another way to exit a lua script from within a function or if I should open a Jira.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Mar 10, 2016 at 4:21 PM, Abaci B <span dir="ltr" class="">&lt;<a href="mailto:abaci64@gmail.com" target="_blank" class="">abaci64@gmail.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="">I would expect to be able to exit from a lua script without a while loop, should I open a feature request on Jira for that?</div><div class=""><div class=""><div class=""><br class=""></div><div class="gmail_extra"><div class="gmail_quote">On Wed, Mar 9, 2016 at 1:20 AM, Chad Phillips <span dir="ltr" class="">&lt;<a href="mailto:chad@apartmentlines.com" target="_blank" class="">chad@apartmentlines.com</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="">Andrew,<div class=""><br class=""></div><div class="">Curious if this structure will work at the bottom of either a a Lua script or Lua function:</div><div class=""><br class=""></div><div class="">do</div><div class="">&nbsp; return "exit"</div><div class="">end</div><div class=""><br class=""></div><div class="">I seem to recall that being a trick that helped for weird 'return' cases.</div><span class=""><font color="#888888" class=""><div class=""><br class=""></div><div class="">Chad</div></font></span></div><div class="gmail_extra"><br class=""><div class="gmail_quote"><div class=""><div class="">On Tue, Mar 8, 2016 at 12:54 PM, Andrew Keil <span dir="ltr" class="">&lt;<a href="mailto:andrew.keil@visytel.com" target="_blank" class="">andrew.keil@visytel.com</a>&gt;</span> wrote:<br class=""></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class="">





<div lang="EN-AU" link="blue" vlink="purple" class="">
<div class=""><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">Michael,<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">I have just run some more tests and you are correct that calling it inside a while loop like what you explained below does work outside of the hangup
 hook handler.&nbsp; Thanks for providing this extra information.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">It should be noted that it does not work on its own simply at the bottom of a Lua function (ie. as the last statement without a while loop) -&nbsp; except
 as the last statement inside the hangup hook function.<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">ie. This works:<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">----------------------------------------------------------------<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">function CleanUp()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog("CLEANUP SECTION\n")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog("CLEANUP SECTION COMPLETE\n")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">end<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">function myHangupHook(s, status, arg)<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(string.format("%s DETECTED\n",arg))<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:hangup()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Run CleanUp function now since the caller has disconnected&nbsp;&nbsp;
<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CleanUp()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Abort Lua script here to avoid returning to MainService()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return "exit"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">end<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">-- Setup Hangup event handler here<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">v_hangup = "HANGUP"<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">session:setHangupHook("myHangupHook", "v_hangup")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">Whereas this does not work:<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">----------------------------------------------------------------<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">function CleanUp()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog("CLEANUP SECTION\n")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog("CLEANUP SECTION COMPLETE\n")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return "exit"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">end&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">function myHangupHook(s, status, arg)<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; freeswitch.consoleLog(string.format("%s DETECTED\n",arg))<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; session:hangup()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Run CleanUp function now since the caller has disconnected&nbsp;&nbsp;
<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CleanUp()<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">end<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">-- Setup Hangup event handler here<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">v_hangup = "HANGUP"<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">session:setHangupHook("myHangupHook", "v_hangup")<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><a name="m_4531360003437178456_m_1710721875543731147_-1920980919_-766515437_1060642169__MailEndCompose" class=""><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">Regards,<u class=""></u><u class=""></u></span></a></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">Andrew<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""><u class=""></u>&nbsp;<u class=""></u></span></p><p class="MsoNormal"><b class=""><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class="">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif" class=""> <a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank" class="">freeswitch-users-bounces@lists.freeswitch.org</a> [mailto:<a href="mailto:freeswitch-users-bounces@lists.freeswitch.org" target="_blank" class="">freeswitch-users-bounces@lists.freeswitch.org</a>]
<b class="">On Behalf Of </b>Michael Collins<br class="">
<b class="">Sent:</b> Saturday, 5 March 2016 8:11 AM<br class="">
<b class="">To:</b> FreeSWITCH Users Help &lt;<a href="mailto:freeswitch-users@lists.freeswitch.org" target="_blank" class="">freeswitch-users@lists.freeswitch.org</a>&gt;<br class="">
<b class="">Subject:</b> Re: [Freeswitch-users] Re- End Lua script after HangupHook handled without all the extra code to handle the return to the function<u class=""></u><u class=""></u></span></p><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
<div class=""><p class="MsoNormal">On Fri, Mar 4, 2016 at 9:19 AM, Abaci B &lt;<a href="mailto:abaci64@gmail.com" target="_blank" class="">abaci64@gmail.com</a>&gt; wrote:<u class=""></u><u class=""></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm" class="">
<div class=""><p class="MsoNormal">The question is not how to figure out when to exit the lua script, the question is&nbsp;<b class="">how to exit&nbsp;the lua script</b>, and that can sometimes be tricky or complicated as return "exit" only works from hangup hook.<u class=""></u><u class=""></u></p>
</div>
</blockquote>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Are you positive that it works only from a hangup hook? It seems to work at the end of any loop:<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">-- testing exit (no session, call with luarun)</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">freeswitch.consoleLog('INFO',"Starting infinite loop...\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">while(1) do</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">&nbsp; freeswitch.consoleLog('WARNING',"Before exit...\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">&nbsp; return "exit"</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">end</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">freeswitch.consoleLog('INFO',"All done!\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">Or with a session:<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">-- test exit with session, no hangup hook</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">session:answer()</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">freeswitch.consoleLog('INFO',"Entering main loop...\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">while ( session:ready() == true ) do</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">&nbsp; freeswitch.consoleLog('WARNING',"Inside loop...\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">&nbsp; return "exit"</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">end</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><span style="font-family:&quot;Courier New&quot;" class="">freeswitch.consoleLog('INFO',"All done!\n")</span><u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">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?<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal"><u class=""></u>&nbsp;<u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">-MC<u class=""></u><u class=""></u></p>
</div>
<div class=""><p class="MsoNormal">&nbsp;<u class=""></u><u class=""></u></p>
</div>
</div>
</div>
</div>
</div>
</div>

<br class=""></div></div><span class="">_________________________________________________________________________<br class="">
Professional FreeSWITCH Consulting Services:<br class="">
<a href="mailto:consulting@freeswitch.org" target="_blank" class="">consulting@freeswitch.org</a><br class="">
<a href="http://www.freeswitchsolutions.com/" target="_blank" rel="noreferrer" class="">http://www.freeswitchsolutions.com</a><br class="">
<br class="">
Official FreeSWITCH Sites<br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class="">
<a href="http://confluence.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://confluence.freeswitch.org</a><br class="">
<a href="http://www.cluecon.com/" target="_blank" rel="noreferrer" class="">http://www.cluecon.com</a><br class="">
<br class="">
FreeSWITCH-users mailing list<br class="">
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" class="">FreeSWITCH-users@lists.freeswitch.org</a><br class="">
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br class="">
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class=""></span></blockquote></div><br class=""></div>
<br class="">_________________________________________________________________________<br class="">
Professional FreeSWITCH Consulting Services:<br class="">
<a href="mailto:consulting@freeswitch.org" target="_blank" class="">consulting@freeswitch.org</a><br class="">
<a href="http://www.freeswitchsolutions.com/" target="_blank" rel="noreferrer" class="">http://www.freeswitchsolutions.com</a><br class="">
<br class="">
Official FreeSWITCH Sites<br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class="">
<a href="http://confluence.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://confluence.freeswitch.org</a><br class="">
<a href="http://www.cluecon.com/" target="_blank" rel="noreferrer" class="">http://www.cluecon.com</a><br class="">
<br class="">
FreeSWITCH-users mailing list<br class="">
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" class="">FreeSWITCH-users@lists.freeswitch.org</a><br class="">
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br class="">
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class=""></blockquote></div><br class=""></div></div></div></div>
</blockquote></div><br class=""></div>
_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services: <br class=""><a href="mailto:consulting@freeswitch.org" target="_blank" class="">consulting@freeswitch.org</a><br class=""><a href="http://www.freeswitchsolutions.com/" target="_blank" class="">http://www.freeswitchsolutions.com</a><br class=""><br class="">Official FreeSWITCH Sites<br class=""><a href="http://www.freeswitch.org/" target="_blank" class="">http://www.freeswitch.org</a><br class=""><a href="http://confluence.freeswitch.org/" target="_blank" class="">http://confluence.freeswitch.org</a><br class=""><a href="http://www.cluecon.com/" target="_blank" class="">http://www.cluecon.com</a><br class=""><br class="">FreeSWITCH-users mailing list<br class=""><a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank" class="">FreeSWITCH-users@lists.freeswitch.org</a><br class=""><a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank" class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br class="">UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank" class="">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br class=""><a href="http://www.freeswitch.org/" target="_blank" class="">http://www.freeswitch.org</a></div></blockquote></div><br class=""></div></div></div></div></div><br class="">_________________________________________________________________________<br class="">
Professional FreeSWITCH Consulting Services:<br class="">
<a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">
<a href="http://www.freeswitchsolutions.com/" target="_blank" rel="noreferrer" class="">http://www.freeswitchsolutions.com</a><br class="">
<br class="">
Official FreeSWITCH Sites<br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class="">
<a href="http://confluence.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://confluence.freeswitch.org</a><br class="">
<a href="http://www.cluecon.com/" target="_blank" rel="noreferrer" class="">http://www.cluecon.com</a><br class="">
<br class="">
FreeSWITCH-users mailing list<br class="">
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" class="">FreeSWITCH-users@lists.freeswitch.org</a><br class="">
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br class="">
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank" rel="noreferrer" class="">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br class="">
<a href="http://www.freeswitch.org/" target="_blank" rel="noreferrer" class="">http://www.freeswitch.org</a><br class=""></blockquote></div><br class=""></div></div>
_________________________________________________________________________<br class="">Professional FreeSWITCH Consulting Services: <br class=""><a href="mailto:consulting@freeswitch.org" class="">consulting@freeswitch.org</a><br class="">http://www.freeswitchsolutions.com<br class=""><br class="">Official FreeSWITCH Sites<br class="">http://www.freeswitch.org<br class="">http://confluence.freeswitch.org<br class="">http://www.cluecon.com<br class=""><br class="">FreeSWITCH-users mailing list<br class="">FreeSWITCH-users@lists.freeswitch.org<br class="">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users<br class="">UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users<br class="">http://www.freeswitch.org</div></blockquote></div><br class=""></body></html>