From 8abe5387aed791295fe437460700331eb575f05c Mon Sep 17 00:00:00 2001 From: konradSC Date: Fri, 4 May 2018 15:32:36 -0400 Subject: [PATCH] Use Freeswitch for mkdir (#3049) This change reduces the strain on the system by running the OS command through Freeswitch rather than directly from Lua. When running directly from Lua it causes RTP jitter in a high capacity system. --- .../scripts/resources/functions/mkdir.lua | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/resources/install/scripts/resources/functions/mkdir.lua b/resources/install/scripts/resources/functions/mkdir.lua index 23a2fd2d12..e871e737fa 100644 --- a/resources/install/scripts/resources/functions/mkdir.lua +++ b/resources/install/scripts/resources/functions/mkdir.lua @@ -1,14 +1,15 @@ - --add the mkdir function - function mkdir(dir) - dir = dir:gsub([[\]], "/"); - if (package.config:sub(1,1) == "/") then - --unix - cmd = [[mkdir -p "]] .. dir .. [["]]; - elseif (package.config:sub(1,1) == [[\]]) then - --windows - cmd = [[mkdir "]] .. dir .. [["]]; - end - os.execute(cmd); - return cmd; - end \ No newline at end of file + function mkdir(dir) + api = freeswitch.API(); + dir = dir:gsub([[\]], "/"); + if (package.config:sub(1,1) == "/") then + --unix + cmd = [[mkdir -p "]] .. dir .. [["]]; + elseif (package.config:sub(1,1) == [[\]]) then + --windows + cmd = [[mkdir "]] .. dir .. [["]]; + end + -- os.execute(cmd); + api:executeString("system " .. cmd ); + return cmd; + end