Cool, Thank you

It works now! no more stale session

session:destroy() and assigned nullable after transfer seems enough on this case

=================== SimpleDialer.lua (after suggestion from Anthony) ============

local threadName = "SimpleDialer"

while true do                             
                                                                                                       
        freeswitch.consoleLog("info", threadName.." ticking\n")                                                                                                   
        -- task run here
        local new_session = freeswitch.Session('sofia/gateway/vox/+15088888888')
        new_session:transfer("echo", "XML", "default")
        new_session:destroy()
        new_session = nil

        freeswitch.msleep(60000)
end


On Wed, Apr 10, 2013 at 4:17 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote:
try

new_session:setAutoHangup(0);
new_session:destroy();

before you transfer it.
and 

new_session = undefined;

after you transfer it.

The sessions are tied to the garbage collector so until the script frees the script version of the session the core can't free the real version.

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.









On Wed, Apr 10, 2013 at 2:34 PM, Johny Kadarisman Kwan <jkr888@gmail.com> wrote:
I have lua 'background' script that wake up every few seconds, and check to perform specific task, one of it to established call.
Calls are then initiated then transfer to some extension in dialplan. The scripts has been running and works as expected.
But after session ended(hangup), channels is not released and can be seen using cli "show channels". and trying to kill such channel result in "-ERR No Such Channel!"

This seems being reported before, but I can't seems to find any resolution.

Following simple script could replicate the issues : 

freeswitch> luarun SimpleDialer.lua

=================== SimpleDialer.lua

local threadName = "SimpleDialer"

while true do                             
                                                                                                       
        freeswitch.consoleLog("info", threadName.." ticking\n")                                                                                                    
        -- task run here
        local new_session = freeswitch.Session('sofia/gateway/vox/+15088888888')
        new_session:transfer("echo", "XML", "default")

        freeswitch.msleep(60000)
end

============= dialplan entry

    <extension name="echo">
      <condition field="destination_number" expression="^echo$">
              <action application="echo" data=""/>
      </condition>
    </extension>        


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org