Sync the changes to fix conference recording from the dev branch. Add a few comments and make the indentation consistent.
This commit is contained in:
@@ -673,15 +673,6 @@
|
|||||||
--cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
|
--cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
|
||||||
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
|
||||||
--response = api:executeString(cmd);
|
--response = api:executeString(cmd);
|
||||||
--record the conference when it exists
|
|
||||||
-- if (conference_exists) then
|
|
||||||
-- --send a command to record the conference
|
|
||||||
-- if (not file_exists(recording..".wav")) then
|
|
||||||
-- cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
|
|
||||||
-- --freeswitch.consoleLog("notice", "[conference center] cmd: " .. cmd .. "\n");
|
|
||||||
-- response = api:executeString(cmd);
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--announce the caller
|
--announce the caller
|
||||||
@@ -729,7 +720,6 @@
|
|||||||
api:executeString(cmd);
|
api:executeString(cmd);
|
||||||
end
|
end
|
||||||
--send the call to the conference
|
--send the call to the conference
|
||||||
|
|
||||||
cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}";
|
cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}";
|
||||||
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
|
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
|
||||||
session:execute("conference", cmd);
|
session:execute("conference", cmd);
|
||||||
|
|||||||
+41
-38
@@ -1,9 +1,12 @@
|
|||||||
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
--get the scripts directory and include the config.lua
|
||||||
dofile(scripts_dir.."/resources/functions/config.lua");
|
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
||||||
dofile(config());
|
dofile(scripts_dir.."/resources/functions/config.lua");
|
||||||
dofile(scripts_dir.."/resources/functions/file_exists.lua");
|
dofile(config());
|
||||||
dofile(scripts_dir.."/resources/functions/trim.lua");
|
|
||||||
dofile(scripts_dir.."/resources/functions/mkdir.lua");
|
--additional includes
|
||||||
|
dofile(scripts_dir.."/resources/functions/file_exists.lua");
|
||||||
|
dofile(scripts_dir.."/resources/functions/trim.lua");
|
||||||
|
dofile(scripts_dir.."/resources/functions/mkdir.lua");
|
||||||
|
|
||||||
--get the argv values
|
--get the argv values
|
||||||
script_name = argv[0];
|
script_name = argv[0];
|
||||||
@@ -15,38 +18,38 @@ dofile(scripts_dir.."/resources/functions/mkdir.lua");
|
|||||||
--prepare the api object
|
--prepare the api object
|
||||||
api = freeswitch.API();
|
api = freeswitch.API();
|
||||||
|
|
||||||
|
--check if the conference exists
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list";
|
||||||
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
|
||||||
result = trim(api:executeString(cmd));
|
result = trim(api:executeString(cmd));
|
||||||
|
if (string.sub(result, -9) == "not found") then
|
||||||
if (string.sub(result, -9) == "not found") then
|
conference_exists = false;
|
||||||
conference_exists = false;
|
else
|
||||||
else
|
conference_exists = true;
|
||||||
conference_exists = true;
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
if (conference_exists) then
|
|
||||||
result = string.match(result,[[<conference (.-)>]],1);
|
|
||||||
conference_session_uuid = string.match(result,[[uuid="(.-)"]],1);
|
|
||||||
freeswitch.consoleLog("INFO","[start-recording] conference_session_uuid: " .. conference_session_uuid .. "\n");
|
|
||||||
|
|
||||||
start_epoch = os.time();
|
|
||||||
|
|
||||||
--set the recording variable
|
|
||||||
if (domain_count > 1) then
|
|
||||||
recordings_dir = recordings_dir.."/"..domain_name;
|
|
||||||
end
|
end
|
||||||
recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
|
|
||||||
mkdir(recordings_dir);
|
|
||||||
recording = recordings_dir.."/"..conference_session_uuid;
|
|
||||||
|
|
||||||
--send a command to record the conference
|
--start the recording
|
||||||
if (not file_exists(recording..".wav")) then
|
if (conference_exists) then
|
||||||
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
|
--get the conference session uuid
|
||||||
freeswitch.consoleLog("notice", "[start-recording] cmd: " .. cmd .. "\n");
|
result = string.match(result,[[<conference (.-)>]],1);
|
||||||
response = api:executeString(cmd);
|
conference_session_uuid = string.match(result,[[uuid="(.-)"]],1);
|
||||||
|
freeswitch.consoleLog("INFO","[start-recording] conference_session_uuid: " .. conference_session_uuid .. "\n");
|
||||||
|
|
||||||
|
--get the current time
|
||||||
|
start_epoch = os.time();
|
||||||
|
|
||||||
|
--set the recording variable
|
||||||
|
if (domain_count > 1) then
|
||||||
|
recordings_dir = recordings_dir.."/"..domain_name;
|
||||||
|
end
|
||||||
|
recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
|
||||||
|
mkdir(recordings_dir);
|
||||||
|
recording = recordings_dir.."/"..conference_session_uuid;
|
||||||
|
|
||||||
|
--send a command to record the conference
|
||||||
|
if (not file_exists(recording..".wav")) then
|
||||||
|
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
|
||||||
|
freeswitch.consoleLog("notice", "[start-recording] cmd: " .. cmd .. "\n");
|
||||||
|
response = api:executeString(cmd);
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user