Generally you could avoid this by checking session status. Below is an example.

function selectAge (langId)

   session:flushDigits()

   digits = ""
   while ("" == digits) do

      if not session:ready() then return nil end

      digits = session:playAndGetDigits(2, 3, 1, 5000, "#",
              wav_base .. langId .. "/" .. age_prompt_wav,
              wav_base .. langId .. "/" .. age_incorrect_wav,
              "\\d+");

      log("info", "Got dtmf: ".. digits .."\n");
      if "" ~= digits then
         if (age_max < tonumber(digits) or age_min > tonumber(digits) ) then
             log("info", "Incorrect age: ".. digits ..".. retrying\n");
             session:streamFile (wav_base .. langId .. "/" .. age_incorrect_wav)
             digits = ""
         end
      end

   end

   log("info", "Got age dtmf: ".. digits .."\n");
   return tonumber(digits)
end



On 02/10/2010 01:17 PM, Chia-Yen Wu wrote:
Hello, 
i tried to use Lua script to replace xml macro in dialplan,
but I found out that Lua wont terminate if client hangup,
,so the session is still on but client is already hangup,
is there a way to avoid this ?

_______________________________________________ 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