From 11864f504b910388c5f8cba7dd40f8d27dfd9042 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 12 Apr 2014 17:42:23 +0000 Subject: [PATCH] Make sure the recording directory exists --- .../app/dialplan/resources/after/010_user_record.lua | 7 +++++-- resources/switch.php | 9 --------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua b/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua index cbf6e9c78d..d78ebf1af7 100644 --- a/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua +++ b/resources/install/scripts/app/dialplan/resources/after/010_user_record.lua @@ -5,7 +5,10 @@ if (domain_count > 1) then path = path.."/"..domain_name; end - path = path.."/archive/"..(os.date("%Y")).."/"..(os.date("%b")).."/"..(os.date("%d")).."/"..uuid..".wav"; + path = path.."/archive/"..(os.date("%Y")).."/"..(os.date("%b")).."/"..(os.date("%d")); + + --make sure the path exists + api:executeString("system mkdir -p "..path); --check whether to record the to user if (user_exists == "true") then @@ -66,7 +69,7 @@ --record the session if (record_session) then - cmd = "uuid_record "..uuid.." start "..path; + cmd = "uuid_record "..uuid.." start "..path.."/"..uuid..".wav"; session:execute("set", "api_on_answer="..cmd); --freeswitch.consoleLog("notice", "[app:dialplan] "..cmd.."\n"); end diff --git a/resources/switch.php b/resources/switch.php index e377177bda..3cd186ecac 100644 --- a/resources/switch.php +++ b/resources/switch.php @@ -141,15 +141,6 @@ foreach($settings_array as $name => $value) { } */ -//create the recordings/archive/year/month/day directory structure - $recording_archive_dir = $_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M")."/".date("d"); - if(!is_dir($recording_archive_dir)) { - mkdir($recording_archive_dir, 0764, true); - chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y"), 0764); - chmod($_SESSION['switch']['recordings']['dir']."/archive/".date("Y")."/".date("M"), 0764); - chmod($recording_archive_dir, 0764); - } - //get the event socket information if (file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/settings/app_config.php")) { if (strlen($_SESSION['event_socket_ip_address']) == 0) {