Add conference sessions and meetings.

This commit is contained in:
Mark Crane 2012-09-13 02:52:43 +00:00
parent d5b4dd9382
commit 88874bee15
6 changed files with 406 additions and 40 deletions

View File

@ -76,6 +76,10 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the conference extension number.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_session_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enable or disable conference sessions.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_pin_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Optional pin number to secure access to the conference.';
@ -98,7 +102,7 @@
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'conference_enabled';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Select whether to enable or disable the conference.';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enable or disable the conference.';
$y = 1; //table array index
$z = 0; //field array index

View File

@ -50,6 +50,7 @@ else {
$conference_extension = check_str($_POST["conference_extension"]);
$conference_pin_number = check_str($_POST["conference_pin_number"]);
$conference_profile = check_str($_POST["conference_profile"]);
$conference_session_enabled = check_str($_POST["conference_session_enabled"]);
$conference_flags = check_str($_POST["conference_flags"]);
$conference_order = check_str($_POST["conference_order"]);
$conference_description = check_str($_POST["conference_description"]);
@ -121,6 +122,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($conference_extension) == 0) { $msg .= "Please provide: Extension<br>\n"; }
//if (strlen($conference_pin_number) == 0) { $msg .= "Please provide: Pin Number<br>\n"; }
if (strlen($conference_profile) == 0) { $msg .= "Please provide: Profile<br>\n"; }
if (strlen($conference_session_enabled) == 0) { $msg .= "Please provide: Sessions<br>\n"; }
//if (strlen($conference_flags) == 0) { $msg .= "Please provide: Flags<br>\n"; }
//if (strlen($conference_order) == 0) { $msg .= "Please provide: Order<br>\n"; }
//if (strlen($conference_description) == 0) { $msg .= "Please provide: Description<br>\n"; }
@ -154,6 +156,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "conference_extension, ";
$sql .= "conference_pin_number, ";
$sql .= "conference_profile, ";
$sql .= "conference_session_enabled, ";
$sql .= "conference_flags, ";
$sql .= "conference_order, ";
$sql .= "conference_description, ";
@ -168,6 +171,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "'$conference_extension', ";
$sql .= "'$conference_pin_number', ";
$sql .= "'$conference_profile', ";
$sql .= "'$conference_session_enabled', ";
$sql .= "'$conference_flags', ";
$sql .= "'$conference_order', ";
$sql .= "'$conference_description', ";
@ -193,23 +197,27 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//<action application="answer" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'answer';
$dialplan_detail_data = '';
$dialplan_detail_order = '010';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
if ($conference_session_enabled == "true") {
//<action application="lua" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'lua';
$dialplan_detail_data = 'conference.lua';
$dialplan_detail_order = '020';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
else {
//<action application="conference" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'conference';
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
$dialplan_detail_order = '020';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
//<action application="answer" />
$dialplan_detail_tag = 'action'; //condition, action, antiaction
$dialplan_detail_type = 'conference';
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
$dialplan_detail_order = '020';
$dialplan_detail_group = '2';
dialplan_detail_add($_SESSION['domain_uuid'], $dialplan_uuid, $dialplan_detail_tag, $dialplan_detail_order, $dialplan_detail_group, $dialplan_detail_type, $dialplan_detail_data);
}
//save the xml
save_dialplan_xml();
@ -234,6 +242,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "conference_extension = '$conference_extension', ";
$sql .= "conference_pin_number = '$conference_pin_number', ";
$sql .= "conference_profile = '$conference_profile', ";
$sql .= "conference_session_enabled = '$conference_session_enabled', ";
$sql .= "conference_flags = '$conference_flags', ";
$sql .= "conference_order = '$conference_order', ";
$sql .= "conference_description = '$conference_description', ";
@ -258,7 +267,6 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
//update dialplan detail condition
$sql = "";
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_data = '^".$conference_extension."$' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
@ -269,14 +277,22 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql);
//update dialplan detail action
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
if ($conference_session_enabled == "true") {
$dialplan_detail_type = 'lua';
$dialplan_detail_data = 'conference.lua';
}
else {
$dialplan_detail_type = 'conference';
$pin_number = ''; if (strlen($conference_pin_number) > 0) { $pin_number = "+".$conference_pin_number; }
$flags = ''; if (strlen($conference_flags) > 0) { $flags = "+flags{".$conference_flags."}"; }
$dialplan_detail_data = $conference_name.'-'.$_SESSION['domain_name']."@".$conference_profile.$pin_number.$flags;
}
$sql = "update v_dialplan_details set ";
$sql .= "dialplan_detail_type = '".$dialplan_detail_type."', ";
$sql .= "dialplan_detail_data = '".$dialplan_detail_data."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and dialplan_detail_tag = 'action' ";
$sql .= "and dialplan_detail_type = 'conference' ";
$sql .= "and (dialplan_detail_type = 'conference' or dialplan_detail_type = 'lua') ";
$sql .= "and dialplan_uuid = '$dialplan_uuid' ";
$db->query($sql);
@ -313,6 +329,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$conference_extension = $row["conference_extension"];
$conference_pin_number = $row["conference_pin_number"];
$conference_profile = $row["conference_profile"];
$conference_session_enabled = $row["conference_session_enabled"];
$conference_flags = $row["conference_flags"];
$conference_order = $row["conference_order"];
$conference_description = $row["conference_description"];
@ -322,6 +339,10 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset ($prep_statement);
}
//set defaults
if (strlen($conference_enabled) == 0) { $conference_enabled = "true"; }
if (strlen($conference_session_enabled) == 0) { $conference_session_enabled = "false"; }
//show the header
require_once "includes/header.php";
@ -336,18 +357,13 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "<div align='center'>\n";
echo "<table width='100%' border='0' cellpadding='6' cellspacing='0'>\n";
echo "<tr>\n";
if ($action == "add") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Conference Add</b></td>\n";
}
if ($action == "update") {
echo "<td align='left' width='30%' nowrap='nowrap'><b>Conference Edit</b></td>\n";
}
echo "<td align='left' width='30%' nowrap='nowrap'><b>Conference</b></td>\n";
echo "<td width='70%' align='right'><input type='button' class='btn' name='' alt='back' onclick=\"window.location='conferences.php'\" value='Back'></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td align='left' colspan='2'>\n";
echo "Conferences is used to setup conference rooms with a name, description, and optional pin number. \n";
echo "Click on <a href='".PROJECT_PATH."/app/conferences_active/v_conference_interactive.php?c=".str_replace(" ", "-", $conference_name)."'>Active Conference</a> \n";
echo "Click on <a href='".PROJECT_PATH."/app/conferences_active/conference_interactive.php?c=".str_replace(" ", "-", $conference_name)."'>Active Conference</a> \n";
echo "to monitor and interact with the conference room.<br /><br />\n";
echo "</td>\n";
echo "</tr>\n";
@ -452,6 +468,31 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " Sessions:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_session_enabled'>\n";
echo " <option value=''></option>\n";
if ($conference_session_enabled == "true") {
echo " <option value='true' selected='selected'>true</option>\n";
}
else {
echo " <option value='true'>true</option>\n";
}
if ($conference_session_enabled == "false") {
echo " <option value='false' selected='selected'>false</option>\n";
}
else {
echo " <option value='false'>false</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo "Select whether to enable or disable the conference sessions.\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " Flags:\n";

View File

@ -110,7 +110,7 @@ echo "<div align='center'>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"6\" cellspacing=\"0\">\n";
echo " <tr>\n";
echo " <td align='left'><b>Interactive Conference</b><br>\n";
echo " Use this to monitor and interact with the members of the <strong>$conference_display_name</strong> conference.\n";
echo " Use this to monitor and interact with the members of the conference.\n";
echo " </td>\n";
echo " </tr>\n";
echo "</table>\n";

134
app/meetings/app_config.php Normal file
View File

@ -0,0 +1,134 @@
<?php
//application details
$apps[$x]['name'] = 'Users';
$apps[$x]['uuid'] = '6788f73d-4dfa-4303-9ee1-3f090ae91769';
$apps[$x]['category'] = '';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en'] = '';
//menu details
/*
$apps[$x]['menu'][0]['title']['en'] = 'Users';
$apps[$x]['menu'][0]['uuid'] = '8d4920dc-7077-47ab-86c7-cc377ba2a5f5';
$apps[$x]['menu'][0]['parent_uuid'] = 'fd29e39c-c936-f5fc-8e2b-611681b266b5';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/meeting_users/meeting_users.php';
//$apps[$x]['menu'][0]['groups'][] = 'user';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
*/
//permission details
/*
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'meeting_user_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'meeting_user_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'meeting_user_edit';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
//$apps[$x]['permissions'][$y]['groups'][] = 'user';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'meeting_user_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
*/
//schema details
$y = 0; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_meeting_users';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'user_uuid';
$z++;
$y = 1; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_meeting_pins';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_pin_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'member_pin';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the PIN number.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'member_type';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'Enter the member type.';
$z++;
$y = 2; //table array index
$z = 0; //field array index
$apps[$x]['db'][$y]['table'] = 'v_meeting_users';
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'meeting_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key'] = 'foreign';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'user_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['description']['en'] = 'user_uuid';
$z++;
?>

View File

@ -0,0 +1,169 @@
-- conference.lua
-- Part of FusionPBX
-- Copyright (C) 2012 Mark J Crane <markjcrane@fusionpbx.com>
-- All rights reserved.
--
-- Redistribution and use in source and binary forms, with or without
-- modification, are permitted provided that the following conditions are met:
--
-- 1. Redistributions of source code must retain the above copyright notice,
-- this list of conditions and the following disclaimer.
--
-- 2. Redistributions in binary form must reproduce the above copyright
-- 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,
-- 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,
-- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-- POSSIBILITY OF SUCH DAMAGE.
--set variables
flags = "";
max_tries = 3;
digit_timeout = 5000;
--include the lua script
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
include = assert(loadfile(scripts_dir .. "/resources/config.lua"));
include();
--connect to the database
--ODBC - data source name
if (dsn_name) then
dbh = freeswitch.Dbh(dsn_name,dsn_username,dsn_password);
end
--FreeSWITCH core db handler
if (db_type == "sqlite") then
dbh = freeswitch.Dbh("core:"..db_path.."/"..db_name);
end
--make sure the session is ready
if ( session:ready() ) then
session:answer( );
sounds_dir = session:getVariable("sounds_dir");
domain_name = session:getVariable("domain_name");
pin_number = session:getVariable("pin_number");
--get the domain_uuid
if (domain_name ~= nil) then
sql = "SELECT domain_uuid FROM v_domains ";
sql = sql .. "WHERE domain_name = '" .. domain_name .."' ";
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(rows)
domain_uuid = rows["domain_uuid"];
end);
end
--set the sounds path for the language, dialect and voice
default_language = session:getVariable("default_language");
default_dialect = session:getVariable("default_dialect");
default_voice = session:getVariable("default_voice");
if (not default_language) then default_language = 'en'; end
if (not default_dialect) then default_dialect = 'us'; end
if (not default_voice) then default_voice = 'callie'; end
--get the variables
domain_name = session:getVariable("domain_name");
--meeting_uuid = session:getVariable("meeting_uuid");
caller_id_name = session:getVariable("caller_id_name");
caller_id_number = session:getVariable("caller_id_number");
--if the pin number is provided then require it
if (not pin_number) then
min_digits = 3;
max_digits = 12;
pin_number = session:playAndGetDigits(min_digits, max_digits, max_tries, digit_timeout, "#", "phrase:voicemail_enter_pass:#", "", "\\d+");
end
--get the conference sessions
sql = [[SELECT * FROM v_conference_sessions as s, v_meeting_pins as p
WHERE s.domain_uuid = ']] .. domain_uuid ..[['
AND s.meeting_uuid = p.meeting_uuid
AND p.member_pin = ']] .. pin_number ..[['
AND enabled = 'true' ]];
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference] SQL: " .. sql .. "\n");
end
status = dbh:query(sql, function(row)
conference_session_uuid = row["conference_session_uuid"];
conference_uuid = row["conference_uuid"];
meeting_uuid = row["meeting_uuid"];
max_members = row["max_members"];
wait_mod = row["wait_mod"];
member_type = row["member_type"];
announce = row["announce"];
enter_sound = row["enter_sound"];
mute = row["mute"];
created = row["created"];
created_by = row["created_by"];
enabled = row["enabled"];
description = row["description"];
end);
if (conference_uuid ~= nil) then
--set a conference parameter
--conference <confname> set <parameter_name> <value>
if (max_members ~= nil) then
--max members must be 2 or more
session:execute("set","conference_max_members="..max_members);
end
if (mute == "true") then
flags = flags .. "mute";
end
if (enter_sound ~= nil) then
session:execute("set","conference_enter_sound="..enter_sound);
end
if (exit_sound ~= nil) then
session:execute("set","conference_exit_sound="..exit_sound);
end
--working
--get number of peoople in the conference
--conference Conference-Center-voip.fusionpbx.com get count
--get number of seconds since the conference started
--conference Conference-Center-voip.fusionpbx.com get run_time
--get max members in a conference
--conference Conference-Center-voip.fusionpbx.com get max_members
--conference Conference-Center-voip.fusionpbx.com set max_members 3
--sound
--session:execute("set","conference_enter_sound="..enter_sound);
--session:execute("set","conference_exit_sound="..exit_sound);
--used when the first member joins the conference
--session:execute("set","conference_max_members="..max_members);
--if (wait_mod == "true") then
--flags = flags .. "|wait_mod"; --not working
--session:execute("conference","Conference-Center-voip.fusionpbx.com(set conference-flags=wait-mod)"); --not working
--end
if (member_type == "moderator") then
--set as the moderator
flags = flags .. "|moderator";
--when the moderator leaves end the conference
flags = flags .. "|endconf";
--set the moderator controls
session:execute("set","conference_controls=moderator");
end
--send the call to the conference
--session:execute("conference","confname@profilename+[conference pin number]+flags{moderator}");
cmd = meeting_uuid.."-"..domain_name.."@default+flags{".. flags .."}";
freeswitch.consoleLog("notice", "[conference] ".. cmd .."\n");
session:execute("conference",cmd);
--alternative
--uuid_transfer <uuid> conference:3000@default inline
--freeswitch.consoleLog("notice", "[conference] line: 147\n");
else
session:streamFile("phrase:voicemail_fail_auth:#");
session:hangup("NORMAL_CLEARING");
end
end

View File

@ -10,7 +10,21 @@
<!-- Note: none and default are reserved names for group names. Disabled if dist-dtmf member flag is set. -->
<caller-controls>
<group name="default">
<control action="mute" digits="0"/>
<control action="mute" digits=""/>
<control action="deaf mute" digits=""/>
<control action="energy up" digits="9"/>
<control action="energy equ" digits="8"/>
<control action="energy dn" digits="7"/>
<control action="vol talk up" digits="3"/>
<control action="vol talk zero" digits="2"/>
<control action="vol talk dn" digits="1"/>
<control action="vol listen up" digits="6"/>
<control action="vol listen zero" digits="5"/>
<control action="vol listen dn" digits="4"/>
<control action="hangup" digits=""/>
</group>
<group name="moderator">
<control action="mute" digits="#"/>
<control action="deaf mute" digits="*"/>
<control action="energy up" digits="9"/>
<control action="energy equ" digits="8"/>
@ -32,10 +46,10 @@
<!-- Directory to drop CDR's
'auto' means $PREFIX/logs/conference_cdr/<confernece_uuid>.cdr.xml
a non-absolute path means $PREFIX/logs/<value>/<confernece_uuid>.cdr.xml
absolute path means <value>/<confernece_uuid>.cdr.xml
absolute path means <value>/<conference_uuid>.cdr.xml
-->
<!-- <param name="cdr-log-dir" value="auto"/> -->
<param name="cdr-log-dir" value="auto"/>
<!--<param name="conference-flags" value="wait-mod" />-->
<!-- Domain (for presence) -->
<param name="domain" value="$${domain}"/>
<!-- Sample Rate-->
@ -43,7 +57,8 @@
<!-- Number of milliseconds per frame -->
<param name="interval" value="20"/>
<!-- Energy level required for audio to be sent to the other users -->
<param name="energy-level" value="300"/>
<param name="energy-level" value="15"/>
<param name="auto-gain-level" value="50"/>
<!--Can be | delim of waste|mute|deaf|dist-dtmf waste will always transmit data to each channel
even during silence. dist-dtmf propagates dtmfs to all other members, but channel controls
@ -51,9 +66,9 @@
<!--<param name="member-flags" value="waste"/>-->
<!-- Name of the caller control group to use for this profile -->
<!-- <param name="caller-controls" value="some name"/> -->
<param name="caller-controls" value="default"/>
<!-- Name of the caller control group to use for the moderator in this profile -->
<!-- <param name="moderator-controls" value="some name"/> -->
<param name="moderator-controls" value="default"/>
<!-- TTS Engine to use -->
<!--<param name="tts-engine" value="cepstral"/>-->
<!-- TTS Voice to use -->
@ -126,7 +141,8 @@
<param name="domain" value="$${domain}"/>
<param name="rate" value="16000"/>
<param name="interval" value="20"/>
<param name="energy-level" value="300"/>
<param name="energy-level" value="15"/>
<param name="auto-gain-level" value="50"/>
<!--<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>-->
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
@ -151,7 +167,8 @@
<param name="domain" value="$${domain}"/>
<param name="rate" value="32000"/>
<param name="interval" value="20"/>
<param name="energy-level" value="300"/>
<param name="energy-level" value="15"/>
<param name="auto-gain-level" value="50"/>
<!--<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>-->
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>
@ -176,7 +193,8 @@
<param name="domain" value="$${domain}"/>
<param name="rate" value="48000"/>
<param name="interval" value="10"/>
<param name="energy-level" value="300"/>
<param name="energy-level" value="15"/>
<param name="auto-gain-level" value="50"/>
<!--<param name="sound-prefix" value="$${sounds_dir}/en/us/callie"/>-->
<param name="muted-sound" value="conference/conf-muted.wav"/>
<param name="unmuted-sound" value="conference/conf-unmuted.wav"/>