Update local_stream.conf.lua
Use the name/rate for global music on hold or domain_name/name/rate for local. If configuring as a default leave the /rate off the end of the string.
This commit is contained in:
parent
0fb9fadea7
commit
4bbf0983bf
|
|
@ -14,16 +14,30 @@
|
||||||
table.insert(xml, [[ <configuration name="local_stream.conf" description="stream files from local dir">]]);
|
table.insert(xml, [[ <configuration name="local_stream.conf" description="stream files from local dir">]]);
|
||||||
|
|
||||||
--run the query
|
--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 ";
|
sql = sql .. "order by music_on_hold_name asc ";
|
||||||
if (debug["sql"]) then
|
if (debug["sql"]) then
|
||||||
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n");
|
||||||
end
|
end
|
||||||
x = 0;
|
x = 0;
|
||||||
dbh:query(sql, function(row)
|
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
|
--replace the variable with the path to the sounds directory
|
||||||
music_on_hold_path = row.music_on_hold_path:gsub("$${sounds_dir}", sounds_dir);
|
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
|
--add the full path to the chime list
|
||||||
chime_list = row.music_on_hold_chime_list;
|
chime_list = row.music_on_hold_chime_list;
|
||||||
|
|
@ -32,7 +46,7 @@
|
||||||
chime_list = "";
|
chime_list = "";
|
||||||
for k,v in pairs(chime_array) do
|
for k,v in pairs(chime_array) do
|
||||||
f = explode("/", v);
|
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;
|
chime_list = chime_list .. sounds_dir.."/en/us/callie/"..v;
|
||||||
else
|
else
|
||||||
chime_list = chime_list .. v;
|
chime_list = chime_list .. v;
|
||||||
|
|
@ -48,8 +62,8 @@
|
||||||
end
|
end
|
||||||
|
|
||||||
--build the xml ]]..row.music_on_hold_name..[["
|
--build the xml ]]..row.music_on_hold_name..[["
|
||||||
table.insert(xml, [[ <directory name="]]..row.music_on_hold_uuid..[[" stream_name="]]..row.music_on_hold_name..[[" path="]]..music_on_hold_path..[[">]]);
|
table.insert(xml, [[ <directory name="]]..name..[[" uuid="]]..row.music_on_hold_uuid..[[" path="]]..music_on_hold_path..[[">]]);
|
||||||
table.insert(xml, [[ <param name="rate" value="]]..row.music_on_hold_rate..[["/>]]);
|
table.insert(xml, [[ <param name="rate" value="]]..rate..[["/>]]);
|
||||||
table.insert(xml, [[ <param name="shuffle" value="]]..row.music_on_hold_shuffle..[["/>]]);
|
table.insert(xml, [[ <param name="shuffle" value="]]..row.music_on_hold_shuffle..[["/>]]);
|
||||||
table.insert(xml, [[ <param name="channels" value="1"/>]]);
|
table.insert(xml, [[ <param name="channels" value="1"/>]]);
|
||||||
table.insert(xml, [[ <param name="interval" value="20"/>]]);
|
table.insert(xml, [[ <param name="interval" value="20"/>]]);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue