From e29ea615456adad6365a569d8a3fb80938b58ec4 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Sat, 10 Feb 2018 13:35:07 -0700 Subject: [PATCH] Create play_file.lua --- .../install/scripts/resources/functions/play_file.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 resources/install/scripts/resources/functions/play_file.lua diff --git a/resources/install/scripts/resources/functions/play_file.lua b/resources/install/scripts/resources/functions/play_file.lua new file mode 100644 index 0000000000..576565ccf6 --- /dev/null +++ b/resources/install/scripts/resources/functions/play_file.lua @@ -0,0 +1,10 @@ +function play_file(dbh, domain_name, domain_uuid, file_name) + local full_path, is_base64 = find_file(dbh, domain_name, domain_uuid, file_name) + if not full_path then + log.warningf('Can not find audio file: %s. Try using it in raw mode.', file_name) + full_path = file_name + else + log.noticef('Found `%s` as `%s`%s', file_name, full_path, is_base64 and '(BASE64)' or '') + end + session:execute("playback", full_path); +end