Add full path to the music on hold chime list.

This commit is contained in:
markjcrane
2016-06-23 15:29:14 -06:00
parent 8e8454ff19
commit f9d191c520

View File

@@ -25,6 +25,21 @@
--replace the variable with the path to the sounds directory
music_on_hold_path = row.music_on_hold_path:gsub("$${sounds_dir}", sounds_dir);
--add the full path to the chime list
chime_list = row.music_on_hold_chime_list;
if (chime_list ~= nil) then
chime_array = explode(",", chime_list);
chime_list = "";
for k,v in pairs(chime_array) do
f = explode("/", v);
if (file_exists(sounds_dir.."/en/us/callie/"..f[1].."/8000/"..f[2])) then
chime_list = chime_list .. sounds_dir.."/en/us/callie/"..v;
else
chime_list = chime_list .. v;
end
end
end
--build the xml ]]..row.music_on_hold_name..[["
table.insert(xml, [[ <directory name="]]..row.music_on_hold_name..[[" path="]]..music_on_hold_path..[[">]]);
table.insert(xml, [[ <param name="rate" value="]]..row.music_on_hold_rate..[["/>]]);
@@ -32,8 +47,8 @@
table.insert(xml, [[ <param name="channels" value="1"/>]]);
table.insert(xml, [[ <param name="interval" value="20"/>]]);
table.insert(xml, [[ <param name="timer-name" value="]]..row.music_on_hold_timer_name..[["/>]]);
if (row.music_on_hold_chime_list ~= nil) then
table.insert(xml, [[ <param name="chime-list" value="]]..row.music_on_hold_chime_list..[["/>]]);
if (chime_list ~= nil) then
table.insert(xml, [[ <param name="chime-list" value="]]..chime_list..[["/>]]);
end
if (row.music_on_hold_chime_freq ~= nil) then
table.insert(xml, [[ <param name="chime-freq" value="]]..row.music_on_hold_chime_freq..[["/>]]);
@@ -50,9 +65,9 @@
table.insert(xml, [[ </section>]]);
table.insert(xml, [[</document>]]);
XML_STRING = table.concat(xml, "\n");
if (debug["xml_string"]) then
-- if (debug["xml_string"]) then
freeswitch.consoleLog("notice", "[xml_handler] XML_STRING: " .. XML_STRING .. "\n");
end
-- end
--close the database connection
dbh:release();