[Freeswitch-users] Problem Verifying an existing file with lua

Thomas Hoellriegel admin at blindi.net
Sun Nov 6 14:55:10 MSK 2011


Hi all,
I like to export a vatiable to my dialplan.
  The variable file_name_ok should give back the value true if the file exists
My fialplan:
<action application="lua" data="file.lua ${call_screen_filename}"/>
  <action application="log" data="the value: ${file_name_ok}"/>

My problem: i can.t export the variable from the luascript

my scipt:
-- function used to check for the existence of a file
function file_exists(fname)
local f = io.open(fname, "r")
if (f and f:read()) then return true end
end
if ( session:ready() ) then
session:answer( );

datei = session:getVariable("file_name_ok");
if (file_exists(datei..extension..".wav")) then
session:setVariable("file_name_ok", "true");
else
session:setVariable("file_name_ok", "true");
end
end

can your help me please?



---------------
Du kannst mich jederzeit kostenlos per Festnetz erreichen unter:
http://www.blindi.net/callback
homepage: http://www.blindi.net
blinde-misc mailingliste für blinde. anmeldung unter:
http://www.blindi.net/mailman/listinfo/blinde-misc


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