Merge pull request #1609 in FS/freeswitch from ~ASIPLAS/freeswitch:FS-11444-scripts-sound_test.lua-attempts-to-concatenate-boolean to master

* commit '5e895b28c7b0facdfdd8a8a07eff50a464bf9315':
  FS-11444: Capture return code from `os.execute()`; stop attempting to concat boolean/nil to error string.
This commit is contained in:
Brian West 2018-10-11 16:07:34 +00:00
commit 5f3a95277d
1 changed files with 4 additions and 4 deletions

View File

@ -60,15 +60,15 @@ else
-- Looks good, let's play some sound files
sound_base = session:getVariable('sounds_dir') .. '/en/us/callie/' .. stype .. '/' .. srate;
input_file = '/tmp/filez.txt';
res = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file);
freeswitch.consoleLog("INFO","Result of system call: " .. res .. "\n");
if ( res == 0 ) then
res, what, code = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file);
freeswitch.consoleLog("INFO","Result of system call: " .. what .. " " .. code .. "\n");
if ( res == true and what == 'exit' and code == 0 ) then
for fname in io.lines(input_file) do
freeswitch.consoleLog("NOTICE","Playing file: " .. fname .. "\n");
session:streamFile(sound_base .. '/' .. fname);
session:sleep(100);
end
else
freeswitch.consoleLog("ERR","Result of system call: " .. res .. "\n");
freeswitch.consoleLog("ERR","Result of system call: " .. what .. " " .. code .. "\n");
end
end