[Freeswitch-users] Lua script hangup detect

Nazim Agabekov nazim.agabekov at gmail.com
Wed Feb 10 03:28:19 PST 2010


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 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/20100210/a8705c42/attachment-0002.html 


More information about the FreeSWITCH-users mailing list