<div dir="ltr">try<div><br></div><div style>new_session:setAutoHangup(0);</div><div style>new_session:destroy();</div><div style><br></div><div style>before you transfer it.</div><div style>and </div><div style><br></div><div style>
new_session = undefined;</div><div style><br></div><div style>after you transfer it.</div><div style><br></div><div style>The sessions are tied to the garbage collector so until the script frees the script version of the session the core can&#39;t free the real version.</div>
<div style><br></div><div style>the  :destroy() method detaches the 2 so the channel can hangup on its own and you only save the shell of the wrapper in your GC.</div><div style><br></div><div style><br></div><div style><br>
</div><div style><br></div><div style><br></div><div style><br></div><div style><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 10, 2013 at 2:34 PM, Johny Kadarisman Kwan <span dir="ltr">&lt;<a href="mailto:jkr888@gmail.com" target="_blank">jkr888@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have lua &#39;background&#39; script that wake up every few seconds, and check to perform specific task, one of it to established call.</div>
<div dir="ltr">Calls are then initiated then transfer to some extension in dialplan. The scripts has been running and works as expected.</div>
<div dir="ltr">But after session ended(hangup), channels is not released and can be seen using cli &quot;show channels&quot;. and trying to kill such channel result in &quot;-ERR No Such Channel!&quot;</div><div dir="ltr">

<br></div><div dir="ltr">This seems being reported before, but I can&#39;t seems to find any resolution.</div><div dir="ltr"><br></div><div dir="ltr">Following simple script could replicate the issues : </div><div dir="ltr">

<br></div><div dir="ltr">freeswitch&gt; luarun SimpleDialer.lua</div><div dir="ltr"><br></div><div dir="ltr">=================== SimpleDialer.lua</div><div dir="ltr"><br></div><div dir="ltr">local threadName = &quot;SimpleDialer&quot;<br>

<div><br></div><div><div>while true do                             </div><div>                                                                                                       </div>
<div>        freeswitch.consoleLog(&quot;info&quot;, threadName..&quot; ticking\n&quot;)                                                                                                    </div><div>        -- task run here</div>

<div>        local new_session = freeswitch.Session(&#39;sofia/gateway/vox/<a href="tel:%2B15085895115" value="+15085895115" target="_blank">+150</a>88888888&#39;)</div>
<div>        new_session:transfer(&quot;echo&quot;, &quot;XML&quot;, &quot;default&quot;)</div><div><br></div><div>        freeswitch.msleep(60000)</div>
<div>end</div>
</div><div><br></div><div>============= dialplan entry</div><div><br></div><div><div>    &lt;extension name=&quot;echo&quot;&gt;</div><div>      &lt;condition field=&quot;destination_number&quot; expression=&quot;^echo$&quot;&gt;</div>

<div>              &lt;action application=&quot;echo&quot; data=&quot;&quot;/&gt;</div><div>      &lt;/condition&gt;</div><div>    &lt;/extension&gt;        </div></div><div><br></div></div>
<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>Anthony Minessale II<br><br>FreeSWITCH <a href="http://www.freeswitch.org/">http://www.freeswitch.org/</a><br>ClueCon <a href="http://www.cluecon.com/">http://www.cluecon.com/</a><br>
Twitter: <a href="http://twitter.com/FreeSWITCH_wire">http://twitter.com/FreeSWITCH_wire</a><br><br>AIM: anthm<br><a href="mailto:MSN%3Aanthony_minessale@hotmail.com">MSN:anthony_minessale@hotmail.com</a><br>GTALK/JABBER/<a href="mailto:PAYPAL%3Aanthony.minessale@gmail.com">PAYPAL:anthony.minessale@gmail.com</a><br>
IRC: <a href="http://irc.freenode.net">irc.freenode.net</a> #freeswitch<br><br>FreeSWITCH Developer Conference<br><a href="mailto:sip%3A888@conference.freeswitch.org">sip:888@conference.freeswitch.org</a><br><a href="mailto:googletalk%3Aconf%2B888@conference.freeswitch.org">googletalk:conf+888@conference.freeswitch.org</a><br>
pstn:+19193869900
</div>