Add a general copy function for lua and use it with voicemail forward.
This commit is contained in:
parent
0f10a134b8
commit
1e961d1470
|
|
@ -160,6 +160,7 @@
|
||||||
dofile(scripts_dir.."/resources/functions/explode.lua");
|
dofile(scripts_dir.."/resources/functions/explode.lua");
|
||||||
dofile(scripts_dir.."/resources/functions/format_seconds.lua");
|
dofile(scripts_dir.."/resources/functions/format_seconds.lua");
|
||||||
dofile(scripts_dir.."/resources/functions/mkdir.lua");
|
dofile(scripts_dir.."/resources/functions/mkdir.lua");
|
||||||
|
dofile(scripts_dir.."/resources/functions/copy.lua");
|
||||||
|
|
||||||
--voicemail functions
|
--voicemail functions
|
||||||
dofile(scripts_dir.."/app/voicemail/resources/functions/on_dtmf.lua");
|
dofile(scripts_dir.."/app/voicemail/resources/functions/on_dtmf.lua");
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
|
|
||||||
--if local after email is true then copy the recording file
|
--if local after email is true then copy the recording file
|
||||||
mkdir(voicemail_dir.."/"..forward_voicemail_id);
|
mkdir(voicemail_dir.."/"..forward_voicemail_id);
|
||||||
os.execute("cp '"..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.."' '"..voicemail_dir.."/"..forward_voicemail_id.."/msg_"..uuid.."."..vm_message_ext.."'");
|
copy(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext, voicemail_dir.."/"..forward_voicemail_id.."/msg_"..uuid.."."..vm_message_ext);
|
||||||
|
|
||||||
--send the email with the voicemail recording attached
|
--send the email with the voicemail recording attached
|
||||||
send_email(forward_voicemail_id, uuid);
|
send_email(forward_voicemail_id, uuid);
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
--add the copy function
|
||||||
|
function copy(src,dst)
|
||||||
|
if (package.config:sub(1,1) == "/") then
|
||||||
|
--unix
|
||||||
|
cmd = [[cp "]] .. src .. [[" "]] .. dst .. [["]];
|
||||||
|
elseif (package.config:sub(1,1) == [[\]]) then
|
||||||
|
--windows
|
||||||
|
src = src:gsub("/",[[\]]);
|
||||||
|
dst = dst:gsub("/",[[\]]);
|
||||||
|
cmd = [[copy "]] .. src .. [[" "]] ..dst.. [["]];
|
||||||
|
end
|
||||||
|
os.execute(cmd);
|
||||||
|
return cmd;
|
||||||
|
end
|
||||||
Loading…
Reference in New Issue