From 14235811ed29d6f92289946d2b285823599cfe14 Mon Sep 17 00:00:00 2001 From: luis daniel lucio quiroz Date: Thu, 28 May 2015 18:41:43 +0000 Subject: [PATCH] conference_session_uuid issue fixed, the recording path is now fixed with/without multitenant --- .../scripts/app/conference_center/index.lua | 34 +++++++----- .../resources/scripts/start_recording.lua | 52 +++++++++++++++++++ 2 files changed, 73 insertions(+), 13 deletions(-) create mode 100644 resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua diff --git a/resources/install/scripts/app/conference_center/index.lua b/resources/install/scripts/app/conference_center/index.lua index 9d6c8a14d3..048c103824 100644 --- a/resources/install/scripts/app/conference_center/index.lua +++ b/resources/install/scripts/app/conference_center/index.lua @@ -263,8 +263,9 @@ --freeswitch.consoleLog("notice", "[conference center] sql: " .. sql .. "\n"); --set the conference_recording - conference_recording = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch) .."/"..conference_session_uuid; +conference_recording = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch) .."/"..conference_session_uuid; + freeswitch.consoleLog("notice", "[conference center] conference_recording: "..conference_recording.."\n"); --conference has ended set the end_epoch local sql = {} table.insert(sql, "update v_conference_sessions set "); @@ -410,8 +411,10 @@ session:setHangupHook("session_hangup_hook"); --add the domain to the recording directory + freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n"); if (domain_count > 1) then recordings_dir = recordings_dir.."/"..domain_name; + freeswitch.consoleLog("notice", "[conference center] recordings_dir: " .. recordings_dir .. "\n"); end --sounds @@ -655,10 +658,11 @@ --set the recording variable if (conference_session_uuid ~= nil) then if (record == "true") then - 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; + recordings_dir2 = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch); + mkdir(recordings_dir2); + recording = recordings_dir2.."/"..conference_session_uuid; session:execute("set","recording="..recording); + session:execute("set","conference_session_uuid="..conference_session_uuid); end end @@ -671,14 +675,14 @@ --freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n"); --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 +-- 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 --announce the caller @@ -721,11 +725,15 @@ session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-members_in_conference.wav"); end + if (record == "true") then + cmd="sched_api (+5 none lua app/conference_center/resources/scripts/start_recording.lua "..meeting_uuid.." "..domain_name.." )"; + api:executeString(cmd); + end --send the call to the conference + cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}"; freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n"); session:execute("conference", cmd); end end end - diff --git a/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua new file mode 100644 index 0000000000..65200c3505 --- /dev/null +++ b/resources/install/scripts/app/conference_center/resources/scripts/start_recording.lua @@ -0,0 +1,52 @@ +scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1)); +dofile(scripts_dir.."/resources/functions/config.lua"); +dofile(config()); +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 + script_name = argv[0]; + +--options all, last, non_moderator, member_id + meeting_uuid = argv[1]; + domain_name = argv[2]; + +--prepare the api object + api = freeswitch.API(); + + +cmd = "conference "..meeting_uuid.."-"..domain_name.." xml_list"; +freeswitch.consoleLog("INFO","" .. cmd .. "\n"); +result = trim(api:executeString(cmd)); + +if (string.sub(result, -9) == "not found") then + conference_exists = false; +else + conference_exists = true; +end + + +if (conference_exists) then + result = string.match(result,[[]],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 + 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 +