Update conference.conf.lua

Add conference controls to the xml handler.
This commit is contained in:
FusionPBX
2016-07-17 15:42:14 -06:00
committed by GitHub
parent 6b5bf1cb82
commit 77712fcbf9

View File

@@ -1,6 +1,6 @@
-- xml_handler.lua
-- Part of FusionPBX
-- Copyright (C) 2013 Mark J Crane <markjcrane@fusionpbx.com>
-- Copyright (C) 2016 Mark J Crane <markjcrane@fusionpbx.com>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
@@ -13,7 +13,7 @@
-- notice, this list of conditions and the following disclaimer in the
-- documentation and/or other materials provided with the distribution.
--
-- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-- THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
@@ -37,82 +37,63 @@
table.insert(xml, [[<document type="freeswitch/xml">]]);
table.insert(xml, [[ <section name="configuration">]]);
table.insert(xml, [[ <configuration name="conference.conf" description="Audio Conference">]]);
--start the conference controls
table.insert(xml, [[ <caller-controls>]]);
table.insert(xml, [[ <group name="default">]]);
table.insert(xml, [[ <control action="mute" digits=""/>]]);
table.insert(xml, [[ <control action="deaf mute" digits=""/>]]);
table.insert(xml, [[ <control action="energy up" digits="9"/>]]);
table.insert(xml, [[ <control action="energy equ" digits="8"/>]]);
table.insert(xml, [[ <control action="energy dn" digits="7"/>]]);
table.insert(xml, [[ <control action="vol talk up" digits="3"/>]]);
table.insert(xml, [[ <control action="vol talk zero" digits="2"/>]]);
table.insert(xml, [[ <control action="vol talk dn" digits="1"/>]]);
table.insert(xml, [[ <control action="vol listen up" digits="6"/>]]);
table.insert(xml, [[ <control action="vol listen zero" digits="5"/>]]);
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
table.insert(xml, [[ <control action="hangup" digits=""/>]]);
table.insert(xml, [[ </group>]]);
table.insert(xml, [[ <group name="moderator">]]);
table.insert(xml, [[ <control action="mute" digits=""/>]]);
table.insert(xml, [[ <control action="deaf mute" digits=""/>]]);
table.insert(xml, [[ <control action="energy up" digits="9"/>]]);
table.insert(xml, [[ <control action="energy equ" digits="8"/>]]);
table.insert(xml, [[ <control action="energy dn" digits="7"/>]]);
table.insert(xml, [[ <control action="vol talk up" digits="3"/>]]);
table.insert(xml, [[ <control action="vol talk zero" digits="2"/>]]);
table.insert(xml, [[ <control action="vol talk dn" digits="1"/>]]);
table.insert(xml, [[ <control action="vol listen up" digits="6"/>]]);
table.insert(xml, [[ <control action="vol listen zero" digits="5"/>]]);
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
table.insert(xml, [[ <control action="hangup" digits=""/>]]);
table.insert(xml, [[ <control action="execute_application" digits="0" data="lua app/conference_center/resources/scripts/mute.lua non_moderator"/>]]);
table.insert(xml, [[ <control action="execute_application" digits="*" data="lua app/conference_center/resources/scripts/unmute.lua non_moderator"/>]]);
table.insert(xml, [[ </group>]]);
table.insert(xml, [[ <group name="page">]]);
table.insert(xml, [[ <control action="mute" digits="0"/>]]);
table.insert(xml, [[ <control action="deaf mute" digits=""/>]]);
table.insert(xml, [[ <control action="energy up" digits="9"/>]]);
table.insert(xml, [[ <control action="energy equ" digits="8"/>]]);
table.insert(xml, [[ <control action="energy dn" digits="7"/>]]);
table.insert(xml, [[ <control action="vol talk up" digits="3"/>]]);
table.insert(xml, [[ <control action="vol talk zero" digits="2"/>]]);
table.insert(xml, [[ <control action="vol talk dn" digits="1"/>]]);
table.insert(xml, [[ <control action="vol listen up" digits="6"/>]]);
table.insert(xml, [[ <control action="vol listen zero" digits="5"/>]]);
table.insert(xml, [[ <control action="vol listen dn" digits="4"/>]]);
table.insert(xml, [[ <control action="hangup" digits=""/>]]);
table.insert(xml, [[ </group>]]);
sql = [[SELECT * FROM v_conference_controls
WHERE control_enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(field)
conference_control_uuid = field["conference_control_uuid"];
table.insert(xml, [[ <group name="]]..field["control_name"]..[[">]]);
--get the conference control details from the database
sql = [[SELECT * FROM v_conference_control_details
WHERE conference_control_uuid = ']] .. conference_control_uuid ..[['
AND control_enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference_control] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(row)
--conference_control_uuid = row["conference_control_uuid"];
--conference_control_detail_uuid = row["conference_control_detail_uuid"];
table.insert(xml, [[ <control digits="]]..row["control_digits"]..[[" action="]]..row["control_action"]..[[" data="]]..row["control_data"]..[["/>]]);
end);
table.insert(xml, [[ </group>]]);
end);
table.insert(xml, [[ </caller-controls>]]);
--start the conference profiles
table.insert(xml, [[ <profiles>]]);
sql = [[SELECT * FROM v_conference_profiles
WHERE profile_enabled = 'true' ]];
--start the conference profiles
table.insert(xml, [[ <profiles>]]);
sql = [[SELECT * FROM v_conference_profiles
WHERE profile_enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(field)
conference_profile_uuid = field["conference_profile_uuid"];
table.insert(xml, [[ <profile name="]]..field["profile_name"]..[[">]]);
--get the conference profile parameters from the database
sql = [[SELECT * FROM v_conference_profile_params
WHERE conference_profile_uuid = ']] .. conference_profile_uuid ..[['
AND profile_param_enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(field)
conference_profile_uuid = field["conference_profile_uuid"];
table.insert(xml, [[ <profile name="]]..field["profile_name"]..[[">]]);
--get the conference profile parameters from the database
sql = [[SELECT * FROM v_conference_profile_params
WHERE conference_profile_uuid = ']] .. conference_profile_uuid ..[['
AND profile_param_enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference_profiles] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(row)
--conference_profile_uuid = row["conference_profile_uuid"];
--conference_profile_param_uuid = row["conference_profile_param_uuid"];
--profile_param_description = row["profile_param_description"];
table.insert(xml, [[ <param name="]]..row["profile_param_name"]..[[" value="]]..row["profile_param_value"]..[["/>]]);
end);
table.insert(xml, [[ </profile>]]);
status = dbh:query(sql, function(row)
--conference_profile_uuid = row["conference_profile_uuid"];
--conference_profile_param_uuid = row["conference_profile_param_uuid"];
--profile_param_description = row["profile_param_description"];
table.insert(xml, [[ <param name="]]..row["profile_param_name"]..[[" value="]]..row["profile_param_value"]..[["/>]]);
end);
table.insert(xml, [[ </profile>]]);
end);
table.insert(xml, [[ </profiles>]]);
--set the xml array and then concatenate the array to a string