From d9be32d422931c07b60cf2d91da68c0b7e7aef76 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 8 Jul 2021 12:41:22 -0600 Subject: [PATCH] Add [find_file.lua] to the logging and show file that wasn't found. --- .../scripts/resources/functions/find_file.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/scripts/resources/scripts/resources/functions/find_file.lua b/app/scripts/resources/scripts/resources/functions/find_file.lua index fac04e2f2c..66fa6ee687 100644 --- a/app/scripts/resources/scripts/resources/functions/find_file.lua +++ b/app/scripts/resources/scripts/resources/functions/find_file.lua @@ -8,7 +8,7 @@ local is_absolute_path = require "resources.functions.is_absolute_path" function find_file(dbh, domain_name, domain_uuid, file_name) -- if we specify e.g. full path if (is_absolute_path(file_name) and file.exists(file_name)) then - log.debugf('found file `%s` in file system', file_name) + log.debugf('[find_file.lua] found file `%s` in file system', file_name) return file_name end @@ -18,9 +18,13 @@ function find_file(dbh, domain_name, domain_uuid, file_name) if file_name_only == file_name then -- this can be recordings local full_path = recordings_dir .. "/" .. domain_name .. "/" .. file_name if file.exists(full_path) then - log.debugf('resolve `%s` as recording `%s`', file_name, full_path) + log.debugf('[find_file.lua] `%s` as recording `%s`', file_name, full_path) file_name, found = full_path, true - else -- recordings may be in database + else + --send debug info to the log + log.debugf('[find_file.lua] `%s` as recording `%s`', file_name, full_path) + + -- recordings may be in database local settings = Settings.new(dbh, domain_name, domain_uuid) local storage_type = settings:get('recordings', 'storage_type', 'text') or '' if storage_type == 'base64' then @@ -37,7 +41,7 @@ function find_file(dbh, domain_name, domain_uuid, file_name) dbh:release(); if recording_base64 and #recording_base64 > 32 then - log.debugf('resolve `%s` as recording `%s`(base64)', file_name, full_path) + log.debugf('[find_file.lua] `%s` as recording `%s`(base64)', file_name, full_path) file_name, found, is_base64 = full_path, true, true file.write_base64(file_name, recording_base64) end @@ -65,7 +69,7 @@ function find_file(dbh, domain_name, domain_uuid, file_name) if sounds_dir then found = file.exists(sounds_dir.. "/" ..file_name_only) if found then - log.debugf('resolve `%s` as sound `%s`', file_name, found) + log.debugf('[find_file.lua] `%s` as sound `%s`', file_name, found) file_name, found = found, true end end @@ -78,4 +82,4 @@ function find_file(dbh, domain_name, domain_uuid, file_name) return file_name, is_base64 end -return find_file \ No newline at end of file +return find_file