diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/local_stream.conf.lua b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/local_stream.conf.lua index b0e129ba56..0c2f028616 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/configuration/local_stream.conf.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/configuration/local_stream.conf.lua @@ -14,16 +14,30 @@ table.insert(xml, [[ ]]); --run the query - sql = "select * from v_music_on_hold "; + sql = "select "; + sql = sql .. "(select domain_name from v_domains as d where domain_uuid = s.domain_uuid) as domain_name, * "; + sql = sql .. "from v_music_on_hold as s "; sql = sql .. "order by music_on_hold_name asc "; if (debug["sql"]) then freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n"); end x = 0; dbh:query(sql, function(row) + --combine the name, domain_name and the rate + name = ''; + if (row.domain_uuid ~= nil) then + name = row.domain_name..'/'; + end + name = name .. row.music_on_hold_name; + if (row.music_on_hold_rate ~= nil or row.music_on_hold_rate == '') then + name = name .. '/' .. row.music_on_hold_rate; + end --replace the variable with the path to the sounds directory music_on_hold_path = row.music_on_hold_path:gsub("$${sounds_dir}", sounds_dir); + + --set the rate + rate = row.music_on_hold_rate; --add the full path to the chime list chime_list = row.music_on_hold_chime_list; @@ -32,7 +46,7 @@ chime_list = ""; for k,v in pairs(chime_array) do f = explode("/", v); - if (f[1] ~= nil and f[2] ~= nil and file_exists(sounds_dir.."/en/us/callie/"..f[1].."/8000/"..f[2])) then + if (f[1] ~= nil and f[2] ~= nil and file_exists(sounds_dir.."/en/us/callie/"..f[1].."/"..rate.."/"..f[2])) then chime_list = chime_list .. sounds_dir.."/en/us/callie/"..v; else chime_list = chime_list .. v; @@ -48,8 +62,8 @@ end --build the xml ]]..row.music_on_hold_name..[[" - table.insert(xml, [[ ]]); - table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); table.insert(xml, [[ ]]);