[Freeswitch-users] Stale channel that cannot be killed, session created from a running Lua scripts.

Johny Kadarisman Kwan jkr888 at gmail.com
Thu Apr 11 23:45:14 MSD 2013


These scenario only occurs when initial lua script is running forever ( or
in loop for period of time ).

Initially, I thought calls had been transfer and hangup separately, Lua
standard garbage collection ( using local variable on "new_session") will
take care of cleaning up the var. So it shouldn't lockup the channels.

But,  as what been said

============
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.
============

So, the key is on destroy method. this already documented in wiki, I just
wasn't sure what it meant before.


On Thu, Apr 11, 2013 at 2:25 PM, Abaci <abaci64 at gmail.com> wrote:

>  Can you please document this on the wiki.
>
>
> On 4/10/2013 5:13 PM, Johny Kadarisman Kwan wrote:
>
>  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/+150<%2B15085895115>
> 88888888')
>         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 at 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 at 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/+150<%2B15085895115>
>>> 88888888')
>>>         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 at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at 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 at hotmail.com
>> GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com
>> IRC: irc.freenode.net #freeswitch
>>
>> FreeSWITCH Developer Conference
>> sip:888 at conference.freeswitch.org
>> googletalk:conf+888 at conference.freeswitch.org
>> pstn:+19193869900
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:consulting at freeswitch.orghttp://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
>
> Official FreeSWITCH Siteshttp://www.freeswitch.orghttp://wiki.freeswitch.orghttp://www.cluecon.com
>
> FreeSWITCH-users mailing listFreeSWITCH-users at lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.freeswitch.org
>
>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130411/b358b636/attachment-0001.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list