Deprecate the meetings table and move the moderator and participant pins to the conference rooms table

This commit is contained in:
markjcrane 2021-05-27 02:30:49 -06:00
parent af3610d986
commit 9bf7b8c8ef
6 changed files with 440 additions and 494 deletions

View File

@ -173,9 +173,8 @@
$apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++; $y++;
$apps[$x]['permissions'][$y]['name'] = "conference_session_detail_view"; $apps[$x]['permissions'][$y]['name'] = "conference_session_detail_view";
$apps[$x]['permissions'][$y]['menu']['uuid'] = "95f88726-4706-43f0-b52b-9504a0b8046f"; //$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; //$apps[$x]['permissions'][$y]['groups'][] = "admin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++; $y++;
$apps[$x]['permissions'][$y]['name'] = "conference_session_detail_add"; $apps[$x]['permissions'][$y]['name'] = "conference_session_detail_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
@ -193,6 +192,16 @@
$apps[$x]['permissions'][$y]['groups'][] = "superadmin"; $apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin"; $apps[$x]['permissions'][$y]['groups'][] = "admin";
//default settings
$y=0;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "b321797c-2b77-4213-9339-c9c2794bf457";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "conference_center";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "session_enabled";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "false";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable Conference Sessions";
//cache details //cache details
$apps[$x]['cache']['key'] = "dialplan.\${domain_name}"; $apps[$x]['cache']['key'] = "dialplan.\${domain_name}";
@ -301,6 +310,14 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to record the conference."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select whether to record the conference.";
$z++; $z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "moderator_pin";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the moderator PIN number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "participant_pin";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Enter the participant PIN number.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "max_members"; $apps[$x]['db'][$y]['fields'][$z]['name'] = "max_members";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Limit number of people in the conference."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Limit number of people in the conference.";
@ -357,6 +374,41 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Description.for the conference session."; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Description.for the conference session.";
$y++;
$apps[$x]['db'][$y]['table']['name'] = "v_conference_room_users";
$apps[$x]['db'][$y]['table']['parent'] = "v_conference_rooms";
$z=0;
$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']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_room_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']['type'] = "primary";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "conference_room_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']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_conference_rooms";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "conference_room_uuid";
$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]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_users";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "user_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y++; $y++;
$apps[$x]['db'][$y]['table']['name'] = "v_conference_sessions"; $apps[$x]['db'][$y]['table']['name'] = "v_conference_sessions";
$apps[$x]['db'][$y]['table']['parent'] = ""; $apps[$x]['db'][$y]['table']['parent'] = "";
@ -469,4 +521,4 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric"; $apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "end_epoch"; $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "end_epoch";
?> ?>

View File

@ -55,7 +55,6 @@
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
$conference_center_uuid = $_POST["conference_center_uuid"]; $conference_center_uuid = $_POST["conference_center_uuid"];
$meeting_uuid = $_POST["meeting_uuid"];
$conference_room_name = $_POST['conference_room_name']; $conference_room_name = $_POST['conference_room_name'];
$moderator_pin = $_POST["moderator_pin"]; $moderator_pin = $_POST["moderator_pin"];
$participant_pin = $_POST["participant_pin"]; $participant_pin = $_POST["participant_pin"];
@ -89,9 +88,6 @@
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database; $database = new database;
$conference_centers = $database->select($sql, $parameters, 'all'); $conference_centers = $database->select($sql, $parameters, 'all');
if (!is_uuid($conference_center_uuid)) {
$conference_center_uuid = $conference_centers[0]["conference_center_uuid"];
}
unset($sql, $parameters); unset($sql, $parameters);
//get the conference profiles //get the conference profiles
@ -106,15 +102,16 @@
//set the default //set the default
if ($profile === "") { $profile = "default"; } if ($profile === "") { $profile = "default"; }
//define fucntion get_meeting_pin - used to find a unique pin number //define fucntion get_conference_pin - used to find a unique pin number
function get_meeting_pin($length, $meeting_uuid) { function get_conference_pin($length, $conference_room_uuid) {
$pin = generate_password($length,1); $pin = generate_password($length,1);
$sql = "select count(*) from v_meetings "; $sql = "select count(*) from v_conference_rooms ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
//$sql .= "and meeting_uuid <> :meeting_uuid "; $sql .= "and conference_room_uuid <> :conference_room_uuid ";
$sql .= "and (moderator_pin = :pin or participant_pin = :pin) "; $sql .= "and (moderator_pin = :pin or participant_pin = :pin) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
//$parameters['meeting_uuid'] = $meeting_uuid; $parameters['conference_room_uuid'] = $conference_room_uuid;
$parameters['pin'] = $pin; $parameters['pin'] = $pin;
$database = new database; $database = new database;
$num_rows = $database->select($sql, $parameters, 'column'); $num_rows = $database->select($sql, $parameters, 'column');
@ -122,7 +119,7 @@
return $pin; return $pin;
} }
else { else {
get_meeting_pin($length, $uuid); get_conference_pin($length, $conference_room_uuid);
} }
unset($sql, $parameters); unset($sql, $parameters);
} }
@ -133,7 +130,7 @@
$default_language = 'en'; $default_language = 'en';
$default_dialect = 'us'; $default_dialect = 'us';
$default_voice = 'callie'; $default_voice = 'callie';
$switch_cmd = "conference ".$meeting_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav"; $switch_cmd = "conference ".$conference_room_uuid."@".$_SESSION['domain_name']." play ".$_SESSION['switch']['sounds']['dir']."/".$default_language."/".$default_dialect."/".$default_voice."/ivr/ivr-recording_started.wav";
//connect to event socket //connect to event socket
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) { if ($fp) {
@ -142,41 +139,49 @@
} }
//generate the pins //generate the pins
$sql = "select conference_center_pin_length ";
$sql .= "from v_conference_centers ";
$sql .= "where domain_uuid = :domain_uuid ";
if (is_uuid($conference_center_uuid)) { if (is_uuid($conference_center_uuid)) {
$sql = "select conference_center_pin_length ";
$sql .= "from v_conference_centers ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and conference_center_uuid = :conference_center_uuid "; $sql .= "and conference_center_uuid = :conference_center_uuid ";
$parameters['conference_center_uuid'] = $conference_center_uuid; $parameters['conference_center_uuid'] = $conference_center_uuid;
} $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $database = new database;
$database = new database; $row = $database->select($sql, $parameters, 'row');
$row = $database->select($sql, $parameters, 'row'); if (is_array($row) && sizeof($row) != 0) {
if (is_array($row) && sizeof($row) != 0) { $pin_length = $row['conference_center_pin_length'];
$pin_length = $row['conference_center_pin_length']; }
} unset($sql, $parameters);
unset($sql, $parameters); if (strlen($moderator_pin) == 0) {
if (strlen($moderator_pin) == 0) { $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid);
$moderator_pin = get_meeting_pin($pin_length, $meeting_uuid); }
} if (strlen($participant_pin) == 0) {
if (strlen($participant_pin) == 0) { $participant_pin = get_conference_pin($pin_length, $conference_room_uuid);
$participant_pin = get_meeting_pin($pin_length, $meeting_uuid); }
} }
//delete the user //delete the user
if ($_GET["a"] == "delete" && permission_exists('conference_room_delete')) { if ($_GET["a"] == "delete" && permission_exists('conference_room_delete')) {
if (strlen($_REQUEST["meeting_user_uuid"]) > 0) { if (is_uuid($_REQUEST["conference_room_user_uuid"])) {
//set the variables //set the variables
$meeting_user_uuid = $_REQUEST["meeting_user_uuid"]; $conference_room_user_uuid = $_REQUEST["conference_room_user_uuid"];
$conference_room_uuid = $_REQUEST["conference_room_uuid"]; $conference_room_uuid = $_REQUEST["conference_room_uuid"];
//delete the extension from the ring_group //delete the extension from the ring_group
$array['meeting_users'][0]['meeting_user_uuid'] = $meeting_user_uuid; $array['conference_room_users'][0]['conference_room_user_uuid'] = $conference_room_user_uuid;
$array['meeting_users'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['conference_room_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
//un-assigne the users from the conference room
$p = new permissions;
$p->add('conference_room_user_delete', 'temp');
$database = new database; $database = new database;
$database->app_name = 'conference_centers'; $database->app_name = 'conference_centers';
$database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e'; $database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e';
$database->delete($array); $database->delete($array);
unset($array); unset($array);
$p->delete('conference_room_user_delete', 'temp');
} }
message::add($text['message-delete']); message::add($text['message-delete']);
@ -203,18 +208,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//check for a unique pin number and length //check for a unique pin number and length
if (strlen($moderator_pin) > 0 || strlen($participant_pin) > 0) { if (strlen($moderator_pin) > 0 || strlen($participant_pin) > 0) {
//make sure the moderator pin number is unique //make sure the moderator pin number is unique
$sql = "select count(*) from v_meetings "; $sql = "select count(*) from v_conference_rooms ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
if (is_uuid($meeting_uuid)) { $sql .= "and conference_room_uuid <> :conference_room_uuid ";
$sql .= "and meeting_uuid <> :meeting_uuid ";
$parameters['meeting_uuid'] = $meeting_uuid;
}
$sql .= "and ("; $sql .= "and (";
$sql .= "moderator_pin = :moderator_pin "; $sql .= " moderator_pin = :moderator_pin ";
$sql .= "or participant_pin = :moderator_pin "; $sql .= " or participant_pin = :moderator_pin ";
$sql .= ") "; $sql .= ") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['moderator_pin'] = $moderator_pin; $parameters['moderator_pin'] = $moderator_pin;
$parameters['conference_room_uuid'] = $conference_room_uuid;
$database = new database; $database = new database;
$num_rows = $database->select($sql, $parameters, 'column'); $num_rows = $database->select($sql, $parameters, 'column');
if ($num_rows > 0) { if ($num_rows > 0) {
@ -223,18 +226,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql, $parameters); unset($sql, $parameters);
//make sure the participant pin number is unique //make sure the participant pin number is unique
$sql = "select count(*) from v_meetings "; $sql = "select count(*) from v_conference_rooms ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
if (is_uuid($meeting_uuid)) { $sql .= "and conference_room_uuid <> :conference_room_uuid ";
$sql .= "and meeting_uuid <> :meeting_uuid ";
$parameters['meeting_uuid'] = $meeting_uuid;
}
$sql .= "and ("; $sql .= "and (";
$sql .= "moderator_pin = :participant_pin "; $sql .= " moderator_pin = :participant_pin ";
$sql .= "or participant_pin = :participant_pin "; $sql .= " or participant_pin = :participant_pin ";
$sql .= ") "; $sql .= ") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['participant_pin'] = $participant_pin; $parameters['participant_pin'] = $participant_pin;
$parameters['conference_room_uuid'] = $conference_room_uuid;
$num_rows = $database->select($sql, $parameters, 'column'); $num_rows = $database->select($sql, $parameters, 'column');
if ($num_rows > 0) { if ($num_rows > 0) {
$msg .= $text['message-unique_participant_pin']."<br />\n"; $msg .= $text['message-unique_participant_pin']."<br />\n";
@ -296,35 +297,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($enabled) == 0) { $enabled = 'true'; } if (strlen($enabled) == 0) { $enabled = 'true'; }
if (strlen($sounds) == 0) { $sounds = 'false'; } if (strlen($sounds) == 0) { $sounds = 'false'; }
//add a meeting
$meeting_uuid = uuid();
$array['meetings'][0]['meeting_uuid'] = $meeting_uuid;
$array['meetings'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meetings'][0]['moderator_pin'] = $moderator_pin;
$array['meetings'][0]['participant_pin'] = $participant_pin;
$array['meetings'][0]['enabled'] = $enabled;
$array['meetings'][0]['description'] = $description;
$p = new permissions;
$p->add('meeting_add', 'temp');
$database = new database;
$database->app_name = 'conference_centers';
$database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e';
$database->save($array);
unset($array);
$p->delete('meeting_add', 'temp');
//add a conference room //add a conference room
$conference_room_uuid = uuid(); $conference_room_uuid = uuid();
$array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid; $array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid;
$array['conference_rooms'][0]['conference_center_uuid'] = $conference_center_uuid; $array['conference_rooms'][0]['conference_center_uuid'] = $conference_center_uuid;
$array['conference_rooms'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['conference_rooms'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['conference_rooms'][0]['meeting_uuid'] = $meeting_uuid;
$array['conference_rooms'][0]['conference_room_name'] = $conference_room_name; $array['conference_rooms'][0]['conference_room_name'] = $conference_room_name;
$array['conference_rooms'][0]['profile'] = $profile; $array['conference_rooms'][0]['profile'] = $profile;
$array['conference_rooms'][0]['record'] = $record; $array['conference_rooms'][0]['record'] = $record;
$array['conference_rooms'][0]['moderator_pin'] = $moderator_pin;
$array['conference_rooms'][0]['participant_pin'] = $participant_pin;
$array['conference_rooms'][0]['max_members'] = $max_members; $array['conference_rooms'][0]['max_members'] = $max_members;
$array['conference_rooms'][0]['start_datetime'] = $start_datetime; $array['conference_rooms'][0]['start_datetime'] = $start_datetime;
$array['conference_rooms'][0]['stop_datetime'] = $stop_datetime; $array['conference_rooms'][0]['stop_datetime'] = $stop_datetime;
@ -346,16 +328,16 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$database->save($array); $database->save($array);
unset($array); unset($array);
//assign the logged in user to the meeting //assign the logged in user to the conference room
if (is_uuid($_SESSION["user_uuid"])) { if (is_uuid($_SESSION["user_uuid"])) {
$meeting_user_uuid = uuid(); $conference_room_user_uuid = uuid();
$array['meeting_users'][0]['meeting_user_uuid'] = $meeting_user_uuid; $array['conference_room_users'][0]['conference_room_user_uuid'] = $conference_room_user_uuid;
$array['meeting_users'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['conference_room_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meeting_users'][0]['meeting_uuid'] = $meeting_uuid; $array['conference_room_users'][0]['conference_room_uuid'] = $conference_room_uuid;
$array['meeting_users'][0]['user_uuid'] = $_SESSION["user_uuid"]; $array['conference_room_users'][0]['user_uuid'] = $_SESSION["user_uuid"];
$p = new permissions; $p = new permissions;
$p->add('meeting_user_add', 'temp'); $p->add('conference_room_user_add', 'temp');
$database = new database; $database = new database;
$database->app_name = 'conference_centers'; $database->app_name = 'conference_centers';
@ -363,47 +345,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$database->save($array); $database->save($array);
unset($array); unset($array);
$p->delete('meeting_user_add', 'temp'); $p->delete('conference_room_user_add', 'temp');
} }
message::add($text['message-add']); //add the message
message::add($text['message-add']);
} }
if ($action == "update" && permission_exists('conference_room_edit')) { if ($action == "update" && permission_exists('conference_room_edit')) {
//get the meeting_uuid
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
$conference_room_uuid = $_GET["id"];
$sql = "select * from v_conference_rooms ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and conference_room_uuid = :conference_room_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['conference_room_uuid'] = $conference_room_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && sizeof($row) != 0) {
$meeting_uuid = $row["meeting_uuid"];
}
unset($sql, $parameters, $row);
}
//update conference meetings
$array['meetings'][0]['meeting_uuid'] = $meeting_uuid;
$array['meetings'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meetings'][0]['moderator_pin'] = $moderator_pin;
$array['meetings'][0]['participant_pin'] = $participant_pin;
$array['meetings'][0]['enabled'] = $enabled;
$array['meetings'][0]['description'] = $description;
$p = new permissions;
$p->add('meeting_edit', 'temp');
$database = new database;
$database->app_name = 'conference_centers';
$database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e';
$database->save($array);
unset($array);
$p->delete('meeting_edit', 'temp');
//update the conference room //update the conference room
$array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid; $array['conference_rooms'][0]['conference_room_uuid'] = $conference_room_uuid;
@ -416,6 +365,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($record) > 0) { if (strlen($record) > 0) {
$array['conference_rooms'][0]['record'] = $record; $array['conference_rooms'][0]['record'] = $record;
} }
$array['conference_rooms'][0]['moderator_pin'] = $moderator_pin;
$array['conference_rooms'][0]['participant_pin'] = $participant_pin;
if (strlen($max_members) > 0) { if (strlen($max_members) > 0) {
$array['conference_rooms'][0]['max_members'] = $max_members; $array['conference_rooms'][0]['max_members'] = $max_members;
} }
@ -455,31 +406,31 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
message::add($text['message-update']); message::add($text['message-update']);
} }
//assign the user to the meeting //assign the user to the conference room
if (is_uuid($user_uuid)) { if (is_uuid($user_uuid)) {
$meeting_user_uuid = uuid(); $conference_room_user_uuid = uuid();
$array['meeting_users'][0]['meeting_user_uuid'] = $meeting_user_uuid; $array['conference_room_users'][0]['conference_room_user_uuid'] = $conference_room_user_uuid;
$array['meeting_users'][0]['domain_uuid'] = $_SESSION['domain_uuid']; $array['conference_room_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meeting_users'][0]['meeting_uuid'] = $meeting_uuid; $array['conference_room_users'][0]['conference_room_uuid'] = $conference_room_uuid;
$array['meeting_users'][0]['user_uuid'] = $user_uuid; $array['conference_room_users'][0]['user_uuid'] = $user_uuid;
$p = new permissions; $p = new permissions;
$p->add('meeting_user_add', 'temp'); $p->add('conference_room_user_add', 'temp');
$database = new database; $database = new database;
$database->app_name = 'conference_centers'; $database->app_name = 'conference_centers';
$database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e'; $database->app_uuid = '8d083f5a-f726-42a8-9ffa-8d28f848f10e';
$database->save($array); $database->save($array);
unset($array); unset($array);
$p->delete('meeting_user_add', 'temp'); $p->delete('conference_room_user_add', 'temp');
message::add($text['message-add']); message::add($text['message-add']);
} }
//redirect //redirect
header("Location: conference_room_edit.php?id=".escape($conference_room_uuid)); header("Location: conference_room_edit.php?id=".escape($conference_room_uuid));
exit; exit;
} }
} }
@ -488,22 +439,20 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
//get the conference room details //get the conference room details
$conference_room_uuid = $_REQUEST["id"]; $conference_room_uuid = $_REQUEST["id"];
$sql = "select * from v_conference_rooms as r, v_meetings as m "; $sql = "select * from v_conference_rooms ";
$sql .= "where r.domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and r.meeting_uuid = m.meeting_uuid "; $sql .= "and conference_room_uuid = :conference_room_uuid ";
$sql .= "and r.conference_room_uuid = :conference_room_uuid ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['conference_room_uuid'] = $conference_room_uuid; $parameters['conference_room_uuid'] = $conference_room_uuid;
$database = new database; $database = new database;
$row = $database->select($sql, $parameters, 'row'); $row = $database->select($sql, $parameters, 'row');
if (is_array($row) && sizeof($row) != 0) { if (is_array($row) && sizeof($row) != 0) {
$conference_center_uuid = $row["conference_center_uuid"]; $conference_center_uuid = $row["conference_center_uuid"];
$meeting_uuid = $row["meeting_uuid"];
$moderator_pin = $row["moderator_pin"];
$participant_pin = $row["participant_pin"];
$conference_room_name = $row["conference_room_name"]; $conference_room_name = $row["conference_room_name"];
$profile = $row["profile"]; $profile = $row["profile"];
$record = $row["record"]; $record = $row["record"];
$moderator_pin = $row["moderator_pin"];
$participant_pin = $row["participant_pin"];
$max_members = $row["max_members"]; $max_members = $row["max_members"];
$start_datetime = $row["start_datetime"]; $start_datetime = $row["start_datetime"];
$stop_datetime = $row["stop_datetime"]; $stop_datetime = $row["stop_datetime"];
@ -522,21 +471,21 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
unset($sql, $parameters, $row); unset($sql, $parameters, $row);
} }
//get the users assigned to this meeting //get the users assigned to this conference room
$sql = "select u.username, u.user_uuid, m.meeting_user_uuid "; $sql = "select u.username, u.user_uuid, r.conference_room_user_uuid ";
$sql .= "from v_users as u, v_meeting_users as m "; $sql .= "from v_users as u, v_conference_room_users as r ";
$sql .= "where u.user_uuid = m.user_uuid "; $sql .= "where u.user_uuid = r.user_uuid ";
$sql .= "and m.domain_uuid = :domain_uuid "; $sql .= "and r.domain_uuid = :domain_uuid ";
$sql .= "and m.meeting_uuid = :meeting_uuid "; $sql .= "and r.conference_room_uuid = :conference_room_uuid ";
$sql .= "order by u.username asc "; $sql .= "order by u.username asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['meeting_uuid'] = $meeting_uuid; $parameters['conference_room_uuid'] = $conference_room_uuid;
$database = new database; $database = new database;
$rows = $database->select($sql, $parameters, 'all'); $rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) { if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) { foreach ($rows as $row) {
$meeting_users[$row['user_uuid']]['username'] = $row['username']; $conference_room_users[$row['user_uuid']]['username'] = $row['username'];
$meeting_users[$row['user_uuid']]['meeting_user_uuid'] = $row['meeting_user_uuid']; $conference_room_users[$row['user_uuid']]['conference_room_user_uuid'] = $row['conference_room_user_uuid'];
} }
} }
unset($sql, $parameters); unset($sql, $parameters);
@ -544,8 +493,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the users array //get the users array
$sql = "select user_uuid, username from v_users "; $sql = "select user_uuid, username from v_users ";
$sql .= "where domain_uuid = :domain_uuid "; $sql .= "where domain_uuid = :domain_uuid ";
if (is_array($meeting_users) && @sizeof($meeting_users) != 0) { if (is_array($conference_room_users) && @sizeof($conference_room_users) != 0) {
$sql .= "and user_uuid not in ('".implode("','", array_keys($meeting_users))."') "; $sql .= "and user_uuid not in ('".implode("','", array_keys($conference_room_users))."') ";
} }
$sql .= "order by username asc "; $sql .= "order by username asc ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid']; $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
@ -558,10 +507,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get default pins //get default pins
if (strlen($moderator_pin) == 0) { if (strlen($moderator_pin) == 0) {
$moderator_pin = get_meeting_pin($pin_length, $meeting_uuid); $moderator_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
if (strlen($participant_pin) == 0) { if (strlen($participant_pin) == 0) {
$participant_pin = get_meeting_pin($pin_length, $meeting_uuid); $participant_pin = get_conference_pin($pin_length, $conference_room_uuid);
} }
//format the pins //format the pins
@ -599,9 +548,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <div class='heading'><b>".$text['title-conference_room']."</b></div>\n"; echo " <div class='heading'><b>".$text['title-conference_room']."</b></div>\n";
echo " <div class='actions'>\n"; echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'conference_rooms.php']); echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'conference_rooms.php']);
if (is_uuid($meeting_uuid)) { if (is_uuid($conference_room_uuid)) {
echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'style'=>'margin-left: 15px;','link'=>'../conferences_active/conference_interactive.php?c='.urlencode($meeting_uuid)]); echo button::create(['type'=>'button','label'=>$text['button-view'],'icon'=>$_SESSION['theme']['button_icon_view'],'style'=>'margin-left: 15px;','link'=>'../conferences_active/conference_interactive.php?c='.urlencode($conference_room_uuid)]);
echo button::create(['type'=>'button','label'=>$text['button-sessions'],'icon'=>'list','link'=>'conference_sessions.php?id='.urlencode($meeting_uuid)]); echo button::create(['type'=>'button','label'=>$text['button-sessions'],'icon'=>'list','link'=>'conference_sessions.php?id='.urlencode($conference_room_uuid)]);
} }
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']); echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
echo " </div>\n"; echo " </div>\n";
@ -614,7 +563,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>".$text['label-conference_name']."</td>\n"; echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>".$text['label-conference_name']."</td>\n";
echo "<td width='70%' class='vtable' align='left'>\n"; echo "<td width='70%' class='vtable' align='left'>\n";
echo " <select class='formfld' name='conference_center_uuid'>\n"; echo " <select class='formfld' name='conference_center_uuid'>\n";
foreach ($conference_centers as &$row) { foreach ($conference_centers as $row) {
if ($conference_center_uuid == $row["conference_center_uuid"]) { if ($conference_center_uuid == $row["conference_center_uuid"]) {
echo " <option value='".escape($row["conference_center_uuid"])."' selected='selected'>".escape($row["conference_center_name"])."</option>\n"; echo " <option value='".escape($row["conference_center_uuid"])."' selected='selected'>".escape($row["conference_center_name"])."</option>\n";
} }
@ -640,7 +589,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>"; echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-moderator-pin']."</td>"; echo " <td class='vncell' valign='top'>".$text['label-moderator-pin']."</td>";
echo " <td class='vtable' align='left'>"; echo " <td class='vtable' align='left'>";
echo " <input class='formfld' type='number' name='moderator_pin' maxlength='255' value='".escape($moderator_pin)."'>\n"; echo " <input class='formfld' type='text' name='moderator_pin' maxlength='255' value='".escape($moderator_pin)."'>\n";
echo " <br />\n"; echo " <br />\n";
echo " ".$text['description-moderator_pin']."\n"; echo " ".$text['description-moderator_pin']."\n";
echo " </td>"; echo " </td>";
@ -649,7 +598,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>"; echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-participant-pin']."</td>"; echo " <td class='vncell' valign='top'>".$text['label-participant-pin']."</td>";
echo " <td class='vtable' align='left'>"; echo " <td class='vtable' align='left'>";
echo " <input class='formfld' type='number' name='participant_pin' maxlength='255' value='".escape($participant_pin)."'>\n"; echo " <input class='formfld' type='text' name='participant_pin' maxlength='255' value='".escape($participant_pin)."'>\n";
echo " <br />\n"; echo " <br />\n";
echo " ".$text['description-participant-pin']."\n"; echo " ".$text['description-participant-pin']."\n";
echo " </td>"; echo " </td>";
@ -659,14 +608,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " <tr>"; echo " <tr>";
echo " <td class='vncell' valign='top'>".$text['label-users']."</td>"; echo " <td class='vncell' valign='top'>".$text['label-users']."</td>";
echo " <td class='vtable' align='left'>"; echo " <td class='vtable' align='left'>";
if ($action == "update" && is_array($meeting_users) && @sizeof($meeting_users) != 0) { if ($action == "update" && is_array($conference_room_users) && @sizeof($conference_room_users) != 0) {
echo " <table border='0' style='width : 235px;'>\n"; echo " <table border='0' style='width : 235px;'>\n";
foreach ($meeting_users as $user_uuid => $meeting_user) { foreach ($conference_room_users as $user_uuid => $row) {
echo " <tr>\n"; echo " <tr>\n";
echo " <td class='vtable'>".escape($meeting_user['username'])."</td>\n"; echo " <td class='vtable'>".escape($row['username'])."</td>\n";
echo " <td style='width: 25px;' align='right'>\n"; echo " <td style='width: 25px;' align='right'>\n";
if (permission_exists('conference_room_delete')) { if (permission_exists('conference_room_delete')) {
echo " <a href='conference_room_edit.php?meeting_user_uuid=".escape($meeting_user['meeting_user_uuid'])."&conference_room_uuid=".escape($conference_room_uuid)."&a=delete' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n"; echo " <a href='conference_room_edit.php?conference_room_user_uuid=".escape($row['conference_room_user_uuid'])."&conference_room_uuid=".escape($conference_room_uuid)."&a=delete' alt='delete' onclick=\"return confirm(".$text['confirm-delete'].")\">$v_link_label_delete</a>\n";
} }
echo " </td>\n"; echo " </td>\n";
echo " </tr>\n"; echo " </tr>\n";
@ -975,8 +924,6 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "<br><br>\n"; echo "<br><br>\n";
if ($action == "update") { if ($action == "update") {
echo "<input type='hidden' name='conference_center_uuid' value='".escape($conference_center_uuid)."'>\n";
echo "<input type='hidden' name='meeting_uuid' value='".escape($meeting_uuid)."'>\n";
echo "<input type='hidden' name='conference_room_uuid' value='".escape($conference_room_uuid)."'>\n"; echo "<input type='hidden' name='conference_room_uuid' value='".escape($conference_room_uuid)."'>\n";
} }
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n"; echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";

View File

@ -73,22 +73,6 @@
exit; exit;
} }
//get the meeting_uuid using the pin number
$search = preg_replace('{\D}', '', $_GET["search"]);
if (strlen($search) > 0) {
$sql = "select meeting_uuid ";
$sql .= "from v_meetings ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and ( ";
$sql .= "moderator_pin = :search ";
$sql .= "or participant_pin = :search ";
$sql .= ") ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['search'] = '%'.$search.'%';
$database = new database;
$meeting_uuid = $database->select($sql, $parameters, 'column');
}
/* /*
//if the $_GET array exists then process it //if the $_GET array exists then process it
if (count($_GET) > 0 && strlen($_GET["search"]) == 0) { if (count($_GET) > 0 && strlen($_GET["search"]) == 0) {
@ -100,7 +84,6 @@
$mute = $_GET["mute"]; $mute = $_GET["mute"];
$sounds = $_GET["sounds"]; $sounds = $_GET["sounds"];
$enabled = $_GET["enabled"]; $enabled = $_GET["enabled"];
$meeting_uuid = $_GET["meeting_uuid"];
//record announcement //record announcement
if ($record == "true" && is_uuid($meeting_uuid)) { if ($record == "true" && is_uuid($meeting_uuid)) {
@ -188,9 +171,6 @@
$conference_center = new conference_centers; $conference_center = new conference_centers;
$conference_center->db = $db; $conference_center->db = $db;
$conference_center->domain_uuid = $_SESSION['domain_uuid']; $conference_center->domain_uuid = $_SESSION['domain_uuid'];
if (strlen($meeting_uuid) > 0) {
$conference_center->meeting_uuid = $meeting_uuid;
}
if (strlen($search) > 0) { if (strlen($search) > 0) {
$conference_center->search = $search; $conference_center->search = $search;
} }
@ -211,9 +191,6 @@
$conference_center->offset = $offset; $conference_center->offset = $offset;
$conference_center->order_by = $order_by; $conference_center->order_by = $order_by;
$conference_center->order = $order; $conference_center->order = $order;
if (strlen($meeting_uuid) > 0) {
$conference_center->meeting_uuid = $meeting_uuid;
}
if (strlen($search) > 0) { if (strlen($search) > 0) {
$conference_center->search = $search; $conference_center->search = $search;
} }
@ -297,7 +274,6 @@
echo " </th>\n"; echo " </th>\n";
} }
//echo th_order_by('conference_center_uuid', 'Conference UUID', $order_by, $order); //echo th_order_by('conference_center_uuid', 'Conference UUID', $order_by, $order);
//echo th_order_by('meeting_uuid', 'Meeting UUID', $order_by, $order);
echo "<th>".$text['label-name']."</th>\n"; echo "<th>".$text['label-name']."</th>\n";
echo "<th>".$text['label-moderator-pin']."</th>\n"; echo "<th>".$text['label-moderator-pin']."</th>\n";
echo "<th>".$text['label-participant-pin']."</th>\n"; echo "<th>".$text['label-participant-pin']."</th>\n";
@ -326,7 +302,6 @@
if (is_array($result) > 0) { if (is_array($result) > 0) {
$x = 0; $x = 0;
foreach ($result as $row) { foreach ($result as $row) {
$meeting_uuid = $row['meeting_uuid'];
$conference_room_name = $row['conference_room_name']; $conference_room_name = $row['conference_room_name'];
$moderator_pin = $row['moderator_pin']; $moderator_pin = $row['moderator_pin'];
$participant_pin = $row['participant_pin']; $participant_pin = $row['participant_pin'];
@ -345,14 +320,12 @@
echo " <td class='checkbox'>\n"; echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='conference_rooms[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n"; echo " <input type='checkbox' name='conference_rooms[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='conference_rooms[$x][uuid]' value='".escape($row['conference_room_uuid'])."' />\n"; echo " <input type='hidden' name='conference_rooms[$x][uuid]' value='".escape($row['conference_room_uuid'])."' />\n";
echo " <input type='hidden' name='conference_rooms[$x][meeting_uuid]' value='".escape($meeting_uuid)."' />\n";
echo " </td>\n"; echo " </td>\n";
} }
echo " <td><a href='".$list_row_url."'>".escape($conference_room_name)."</a>&nbsp;</td>\n"; echo " <td><a href='".$list_row_url."'>".escape($conference_room_name)."</a>&nbsp;</td>\n";
echo " <td>".$moderator_pin."</td>\n"; echo " <td>".$moderator_pin."</td>\n";
echo " <td>".$participant_pin."</td>\n"; echo " <td>".$participant_pin."</td>\n";
//echo " <td>".escape($row['conference_center_uuid'])."&nbsp;</td>\n"; //echo " <td>".escape($row['conference_center_uuid'])."&nbsp;</td>\n";
//echo " <td>".escape($row['meeting_uuid'])."&nbsp;</td>\n";
//echo " <td>".escape($row['profile'])."&nbsp;</td>\n"; //echo " <td>".escape($row['profile'])."&nbsp;</td>\n";
if (permission_exists('conference_room_edit')) { if (permission_exists('conference_room_edit')) {
@ -471,8 +444,15 @@
echo " <td class='center'>0</td>\n"; echo " <td class='center'>0</td>\n";
} }
echo " <td class='no-link no-wrap'>\n"; echo " <td class='no-link no-wrap'>\n";
echo " <a href='".PROJECT_PATH."/app/conferences_active/conference_interactive.php?c=".urlencode($row['meeting_uuid'])."'>".$text['label-view']."</a>&nbsp;\n"; if (permission_exists('conference_interactive_view')) {
echo " <a href='conference_sessions.php?id=".urlencode($row['meeting_uuid'])."'>".$text['label-sessions']."</a>\n"; echo " <a href='".PROJECT_PATH."/app/conferences_active/conference_interactive.php?c=".urlencode($row['conference_room_uuid'])."'>".$text['label-view']."</a>&nbsp;\n";
}
if (permission_exists('conference_cdr_view')) {
echo " <a href='/app/conference_cdr/conference_cdr.php?id=".urlencode($row['conference_room_uuid'])."'>".$text['button-cdr']."</a>\n";
}
if (permission_exists('conference_session_view')) {
echo " <a href='conference_sessions.php?id=".urlencode($row['conference_room_uuid'])."'>".$text['label-sessions']."</a>\n";
}
echo " </td>\n"; echo " </td>\n";
if (permission_exists('conference_room_enabled')) { if (permission_exists('conference_room_enabled')) {

View File

@ -17,7 +17,7 @@ The Original Code is FusionPBX
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2019 Portions created by the Initial Developer are Copyright (C) 2008-2021
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -33,7 +33,7 @@ if (!class_exists('conference_centers')) {
* declare public variables * declare public variables
*/ */
public $domain_uuid; public $domain_uuid;
public $meeting_uuid; public $conference_room_uuid;
public $order_by; public $order_by;
public $order; public $order;
public $rows_per_page; public $rows_per_page;
@ -87,20 +87,19 @@ if (!class_exists('conference_centers')) {
if (permission_exists("conference_room_view_all")) { if (permission_exists("conference_room_view_all")) {
$not_admin = 0; $not_admin = 0;
} }
$sql = "select count(*) from v_conference_rooms as r, v_meetings as p "; $sql = "select count(*) from v_conference_rooms as r ";
if ($not_admin) { if ($not_admin) {
$sql .= ",v_meeting_users as u "; $sql .= ", v_conference_room_users as u ";
} }
$sql .= "where r.domain_uuid = :domain_uuid "; $sql .= "where r.domain_uuid = :domain_uuid ";
$sql .= "and r.meeting_uuid = p.meeting_uuid ";
if ($not_admin) { if ($not_admin) {
$sql .= "and r.meeting_uuid = u.meeting_uuid "; $sql .= "and r.conference_room_uuid = u.conference_room_uuid ";
$sql .= "and u.user_uuid = :user_uuid "; $sql .= "and u.user_uuid = :user_uuid ";
$parameters['user_uuid'] = $user_uuid; $parameters['user_uuid'] = $user_uuid;
} }
if (isset($this->meeting_uuid)) { if (isset($this->conference_room_uuid)) {
$sql .= "and r.meeting_uuid = :meeting_uuid "; $sql .= "and r.conference_room_uuid = :conference_room_uuid ";
$parameters['meeting_uuid'] = $this->meeting_uuid; $parameters['conference_room_uuid'] = $this->conference_room_uuid;
} }
if (isset($this->created_by)) { if (isset($this->created_by)) {
@ -139,20 +138,21 @@ if (!class_exists('conference_centers')) {
if (permission_exists("conference_room_view_all")) { if (permission_exists("conference_room_view_all")) {
$not_admin = 0; $not_admin = 0;
} }
$fields = "r.domain_uuid, r.conference_room_uuid, r.conference_center_uuid, r.meeting_uuid, r.conference_room_name, max_members, ";
$fields .= "wait_mod, announce_name, announce_count, announce_recording, mute, sounds, created, created_by, r.enabled, r.description, record, "; $sql = "select ";
$fields .= "profile, moderator_pin, participant_pin"; $sql .= "r.domain_uuid, r.conference_room_uuid, r.conference_center_uuid, r.conference_room_name, r.max_members, ";
$sql .= "wait_mod, announce_name, announce_count, announce_recording, mute, sounds, created, created_by, r.enabled, r.description, record, ";
$sql .= "profile, r.moderator_pin, r.participant_pin ";
if ($not_admin) { if ($not_admin) {
$fields .= ", meeting_user_uuid, user_uuid"; $sql .= ", u.conference_room_user_uuid, u.user_uuid ";
} }
$sql = "select ".$fields." from v_conference_rooms as r, v_meetings as p "; $sql .= "from v_conference_rooms as r ";
if ($not_admin) { if ($not_admin) {
$sql .= ", v_meeting_users as u "; $sql .= ", v_conference_room_users as u ";
} }
$sql .= "where r.domain_uuid = :domain_uuid "; $sql .= "where r.domain_uuid = :domain_uuid ";
$sql .= "and r.meeting_uuid = p.meeting_uuid ";
if ($not_admin) { if ($not_admin) {
$sql .= "and r.meeting_uuid = u.meeting_uuid "; $sql .= "and r.conference_room_uuid = u.conference_room_uuid ";
$sql .= "and u.user_uuid = :user_uuid "; $sql .= "and u.user_uuid = :user_uuid ";
$parameters['user_uuid'] = $_SESSION["user_uuid"]; $parameters['user_uuid'] = $_SESSION["user_uuid"];
} }
@ -160,16 +160,12 @@ if (!class_exists('conference_centers')) {
// $sql .= "and p.member_pin = '".$this->search."' "; // $sql .= "and p.member_pin = '".$this->search."' ";
// $parameters['domain_uuid'] = $this->domain_uuid; // $parameters['domain_uuid'] = $this->domain_uuid;
//} //}
if (isset($this->search)) {
$sql .= "and r.meeting_uuid = :meeting_uuid ";
$parameters['meeting_uuid'] = $this->meeting_uuid;
}
if (isset($this->created_by)) { if (isset($this->created_by)) {
$sql .= "and r.created_by = :created_by "; $sql .= "and r.created_by = :created_by ";
$parameters['created_by'] = $this->created_by; $parameters['created_by'] = $this->created_by;
} }
if (strlen($this->order_by) == 0) { if (strlen($this->order_by) == 0) {
$sql .= "order by r.description, r.meeting_uuid asc "; $sql .= "order by r.description, r.conference_room_uuid asc ";
} }
else { else {
$sql .= "order by $order_by $order "; $sql .= "order by $order_by $order ";
@ -190,7 +186,7 @@ if (!class_exists('conference_centers')) {
$result[$x]["domain_uuid"] = $row["domain_uuid"]; $result[$x]["domain_uuid"] = $row["domain_uuid"];
$result[$x]["conference_room_uuid"] = $row["conference_room_uuid"]; $result[$x]["conference_room_uuid"] = $row["conference_room_uuid"];
$result[$x]["conference_center_uuid"] = $row["conference_center_uuid"]; $result[$x]["conference_center_uuid"] = $row["conference_center_uuid"];
$result[$x]["meeting_uuid"] = $row["meeting_uuid"]; //$result[$x]["meeting_uuid"] = $row["meeting_uuid"];
$result[$x]["conference_room_name"] = $row["conference_room_name"]; $result[$x]["conference_room_name"] = $row["conference_room_name"];
$result[$x]["max_members"] = $row["max_members"]; $result[$x]["max_members"] = $row["max_members"];
$result[$x]["wait_mod"] = $row["wait_mod"]; $result[$x]["wait_mod"] = $row["wait_mod"];
@ -201,7 +197,7 @@ if (!class_exists('conference_centers')) {
$result[$x]["record"] = $row["record"]; $result[$x]["record"] = $row["record"];
$result[$x]["sounds"] = $row["sounds"]; $result[$x]["sounds"] = $row["sounds"];
$result[$x]["profile"] = $row["profile"]; $result[$x]["profile"] = $row["profile"];
$result[$x]["meeting_user_uuid"] = $row["meeting_user_uuid"]; $result[$x]["conference_room_user_uuid"] = $row["conference_room_user_uuid"];
$result[$x]["user_uuid"] = $row["user_uuid"]; $result[$x]["user_uuid"] = $row["user_uuid"];
$result[$x]["moderator_pin"] = $row["moderator_pin"]; $result[$x]["moderator_pin"] = $row["moderator_pin"];
$result[$x]["participant_pin"] = $row["participant_pin"]; $result[$x]["participant_pin"] = $row["participant_pin"];
@ -423,12 +419,8 @@ if (!class_exists('conference_centers')) {
//create array //create array
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid']; $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $record['uuid'];
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid']; $array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
if (is_uuid($record['meeting_uuid'])) { $array['conference_room_users'][$x]['conference_room_uuid'] = $record['uuid'];
$array['meeting_users'][$x]['meeting_uuid'] = $record['meeting_uuid']; $array['conference_room_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meeting_users'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['meetings'][$x]['meeting_uuid'] = $record['meeting_uuid'];
$array['meetings'][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
}
} }
} }
@ -437,8 +429,8 @@ if (!class_exists('conference_centers')) {
//grant temporary permissions //grant temporary permissions
$p = new permissions; $p = new permissions;
$p->add('meeting_user_delete', 'temp'); $p->add('conference_room_user_delete', 'temp');
$p->add('meeting_delete', 'temp'); $p->add('conference_room_delete', 'temp');
//execute delete //execute delete
$database = new database; $database = new database;
@ -448,8 +440,8 @@ if (!class_exists('conference_centers')) {
unset($array); unset($array);
//revoke temporary permissions //revoke temporary permissions
$p->delete('meeting_user_delete', 'temp'); $p->delete('conference_room_user_delete', 'temp');
$p->delete('meeting_delete', 'temp'); $p->delete('conference_room_delete', 'temp');
//set message //set message
message::add($text['message-delete']); message::add($text['message-delete']);
@ -463,7 +455,7 @@ if (!class_exists('conference_centers')) {
//assign private variables //assign private variables
$this->permission_prefix = 'conference_session_'; $this->permission_prefix = 'conference_session_';
$this->list_page = 'conference_sessions.php?id='.$this->meeting_uuid; $this->list_page = 'conference_sessions.php?id='.$this->conference_room_uuid;
$this->table = 'conference_sessions'; $this->table = 'conference_sessions';
$this->uuid_prefix = 'conference_session_'; $this->uuid_prefix = 'conference_session_';
@ -502,8 +494,7 @@ if (!class_exists('conference_centers')) {
//grant temporary permissions //grant temporary permissions
$p = new permissions; $p = new permissions;
$p->add('conference_session_detail_delete', 'temp'); $p->add('conference_session_detail_delete', 'temp');
$p->add('meeting_user_delete', 'temp'); $p->add('conference_user_delete', 'temp');
$p->add('meeting_delete', 'temp');
//execute delete //execute delete
$database = new database; $database = new database;
@ -514,8 +505,7 @@ if (!class_exists('conference_centers')) {
//revoke temporary permissions //revoke temporary permissions
$p->delete('conference_session_detail_delete', 'temp'); $p->delete('conference_session_detail_delete', 'temp');
$p->delete('meeting_user_delete', 'temp'); $p->delete('conference_user_delete', 'temp');
$p->delete('meeting_delete', 'temp');
//set message //set message
message::add($text['message-delete']); message::add($text['message-delete']);
@ -687,10 +677,7 @@ if (!class_exists('conference_centers')) {
foreach ($states as $uuid => $state) { foreach ($states as $uuid => $state) {
$array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid; $array[$this->table][$x][$this->uuid_prefix.'uuid'] = $uuid;
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0]; $array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
if ($this->toggle_field == 'enabled' && is_uuid($meeting_uuid[$uuid])) {
$array['meetings'][$x]['meeting_uuid'] = $meeting_uuid[$uuid];
$array['meetings'][$x]['enabled'] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
}
/* /*
//if toggling to true, start recording //if toggling to true, start recording
if ($this->toggle_field == 'record' && is_uuid($meeting_uuid[$uuid]) && $state == $this->toggle_values[1]) { if ($this->toggle_field == 'record' && is_uuid($meeting_uuid[$uuid]) && $state == $this->toggle_values[1]) {

View File

@ -78,9 +78,11 @@
echo "</tr>\n"; echo "</tr>\n";
$x = 0; $x = 0;
foreach ($xml->conference as $row) { foreach ($xml->conference as $row) {
//set the variables //set the variables
$name = $row['name']; $name = $row['name'];
$member_count = $row['member-count']; $member_count = $row['member-count'];
//show the conferences that have a matching domain //show the conferences that have a matching domain
$name_array = explode('@', $name); $name_array = explode('@', $name);
if ($name_array[1] == $_SESSION['domain_name']) { if ($name_array[1] == $_SESSION['domain_name']) {
@ -90,15 +92,11 @@
if (isset($name_array[0]) && is_uuid($name_array[0])) { if (isset($name_array[0]) && is_uuid($name_array[0])) {
//check for the conference center room //check for the conference center room
$sql = "select "; $sql = "select ";
$sql .= "cr.conference_room_name, "; $sql .= "conference_room_name, ";
$sql .= "v.participant_pin "; $sql .= "participant_pin ";
$sql .= "from "; $sql .= "from v_conference_rooms ";
$sql .= "v_meetings as v, "; $sql .= "where conference_room_uuid = :conference_room_uuid ";
$sql .= "v_conference_rooms as cr "; $parameters['conference_room_uuid'] = $conference_uuid;
$sql .= "where ";
$sql .= "v.meeting_uuid = cr.meeting_uuid ";
$sql .= "and v.meeting_uuid = :meeting_uuid ";
$parameters['meeting_uuid'] = $conference_uuid;
$database = new database; $database = new database;
$conference = $database->select($sql, $parameters, 'row'); $conference = $database->select($sql, $parameters, 'row');
$conference_name = $conference['conference_room_name']; $conference_name = $conference['conference_room_name'];

View File

@ -36,9 +36,15 @@
--debug --debug
debug["sql"] = false; debug["sql"] = false;
--connect to the database --includes
require "resources.functions.config";
local Database = require "resources.functions.database"; local Database = require "resources.functions.database";
local Settings = require "resources.functions.lazy_settings"
dbh = Database.new('system'); dbh = Database.new('system');
local settings = Settings.new(dbh, domain_name, domain_uuid);
--get the cache directory
session_enabled = settings:get('conference_center', 'session_enabled', 'boolean');
--include json library --include json library
local json local json
@ -92,8 +98,8 @@
end end
--get the moderator_pin --get the moderator_pin
local sql = "SELECT moderator_pin FROM v_meetings WHERE meeting_uuid = :meeting_uuid"; local sql = "SELECT moderator_pin FROM v_conference_rooms WHERE conference_room_uuid = :conference_room_uuid";
local params = {meeting_uuid = meeting_uuid} local params = {conference_room_uuid = conference_room_uuid}
freeswitch.consoleLog("notice", "[voicemail] sql: " .. sql .. "; params:" .. json.encode(params) .. "\n"); freeswitch.consoleLog("notice", "[voicemail] sql: " .. sql .. "; params:" .. json.encode(params) .. "\n");
dbh:query(sql, params, function(row) dbh:query(sql, params, function(row)
moderator_pin = string.lower(row["moderator_pin"]); moderator_pin = string.lower(row["moderator_pin"]);
@ -221,7 +227,7 @@
local params = { local params = {
conference_session_uuid = conference_session_uuid; conference_session_uuid = conference_session_uuid;
domain_uuid = domain_uuid; domain_uuid = domain_uuid;
meeting_uuid = meeting_uuid; meeting_uuid = conference_room_uuid;
-- conference_recording = conference_recording; -- conference_recording = conference_recording;
-- wait_mod = wait_mod; -- wait_mod = wait_mod;
-- start_epoch = start_epoch; -- start_epoch = start_epoch;
@ -278,7 +284,7 @@
conference_session_detail_uuid = conference_session_detail_uuid; conference_session_detail_uuid = conference_session_detail_uuid;
domain_uuid = domain_uuid; domain_uuid = domain_uuid;
conference_session_uuid = conference_session_uuid; conference_session_uuid = conference_session_uuid;
meeting_uuid = meeting_uuid; meeting_uuid = conference_room_uuid;
username = username; username = username;
caller_id_name = caller_id_name; caller_id_name = caller_id_name;
caller_id_number = caller_id_number; caller_id_number = caller_id_number;
@ -293,7 +299,7 @@
--if the conference is empty --if the conference is empty
if (conference_session_uuid) then if (conference_session_uuid) then
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list"; cmd = "conference "..conference_room_uuid.."@"..domain_name.." xml_list";
result = trim(api:executeString(cmd)); result = trim(api:executeString(cmd));
if (string.sub(result, -9) == "not found") then if (string.sub(result, -9) == "not found") then
--get the conference start_epoch --get the conference start_epoch
@ -340,28 +346,6 @@
-- os.execute(cmd); -- os.execute(cmd);
--end --end
end end
--send the email addresses
--sql = [[SELECT c.contact_email FROM v_users as u, v_meeting_users as m, v_contacts as c
-- WHERE m.domain_uuid = ']] .. domain_uuid ..[['
-- AND u.user_uuid = m.user_uuid
-- AND m.meeting_uuid = ']] .. meeting_uuid ..[['
-- and u.contact_uuid = c.contact_uuid]];
--if (debug["sql"]) then
-- freeswitch.consoleLog("notice", "[conference center] <email> SQL: " .. sql .. "\n");
--end
--status = dbh:query(sql, function(row)
-- if (row["contact_email"] ~= nil) then
-- contact_email = string.lower(row["contact_email"]);
-- if (string.len(contact_email) > 3) then
-- freeswitch.consoleLog("notice", "[conference center] contact_email: " .. contact_email .. "\n");
-- if (record == "true") then
-- if (file_exists(conference_recording..".wav")) then
-- send_email(contact_email, "", default_language, default_dialect);
-- end
-- end
-- end
-- end
--end);
end end
end end
@ -459,7 +443,12 @@
session:answer(); session:answer();
--set the hangup hook function --set the hangup hook function
session:setHangupHook("session_hangup_hook"); if (session_enabled == 'true') then
freeswitch.consoleLog("notice", "[conference center] session_enabled: true\n");
session:setHangupHook("session_hangup_hook");
else
freeswitch.consoleLog("notice", "[conference center] session_enabled: false\n");
end
--add the domain to the recording directory --add the domain to the recording directory
freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n"); freeswitch.consoleLog("notice", "[conference center] domain_count: " .. domain_count .. "\n");
@ -494,25 +483,22 @@
end end
--use the pin_number to find the conference room --use the pin_number to find the conference room
if (pin_number ~= "") then if (pin_number ~= "") then
local sql = [[SELECT * FROM v_conference_rooms as r, v_meetings as m local sql = [[SELECT * FROM v_conference_rooms
WHERE r.domain_uuid = :domain_uuid WHERE domain_uuid = :domain_uuid
AND r.meeting_uuid = m.meeting_uuid AND (moderator_pin = :pin_number or participant_pin = :pin_number)
AND m.domain_uuid = :domain_uuid AND enabled = 'true'
AND (m.moderator_pin = :pin_number or m.participant_pin = :pin_number)
AND r.enabled = 'true'
AND m.enabled = 'true'
AND ( AND (
( r.start_datetime <> '' AND r.start_datetime is not null AND r.start_datetime <= :timestam ) OR ( start_datetime <> '' AND start_datetime is not null AND start_datetime <= :timestamp ) OR
( r.start_datetime = '' OR r.start_datetime is null ) ( start_datetime = '' OR start_datetime is null )
) )
AND ( AND (
( r.stop_datetime <> '' AND r.stop_datetime is not null AND r.stop_datetime > :timestam ) OR ( stop_datetime <> '' AND stop_datetime is not null AND stop_datetime > :timestamp ) OR
( r.stop_datetime = '' OR r.stop_datetime is null ) ( stop_datetime = '' OR stop_datetime is null )
) ]]; ) ]];
local params = { local params = {
domain_uuid = domain_uuid; domain_uuid = domain_uuid;
pin_number = pin_number; pin_number = pin_number;
timestam = os.date("%Y-%m-%d %X"); timestamp = os.date("%Y-%m-%d %X");
}; };
if (debug["sql"]) then if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n"); freeswitch.consoleLog("notice", "[conference center] SQL: " .. sql .. "; params:" .. json.encode(params) .. "\n");
@ -544,14 +530,11 @@
pin_number = get_pin_number(domain_uuid, conference_center_greeting); pin_number = get_pin_number(domain_uuid, conference_center_greeting);
end end
if (pin_number ~= nil) then if (pin_number ~= nil) then
local sql = [[SELECT * FROM v_conference_rooms as r, v_meetings as m local sql = [[SELECT * FROM v_conference_rooms
WHERE r.domain_uuid = :domain_uuid WHERE domain_uuid = :domain_uuid
AND r.meeting_uuid = m.meeting_uuid AND conference_center_uuid = :conference_center_uuid
AND r.conference_center_uuid = :conference_center_uuid AND (moderator_pin = :pin_number or participant_pin = :pin_number)
AND m.domain_uuid = :domain_uuid AND enabled = 'true'
AND (m.moderator_pin = :pin_number or m.participant_pin = :pin_number)
AND r.enabled = 'true'
AND m.enabled = 'true'
]]; ]];
local params = { local params = {
domain_uuid = domain_uuid; domain_uuid = domain_uuid;
@ -564,7 +547,7 @@
dbh:query(sql, params, function(row) dbh:query(sql, params, function(row)
conference_room_uuid = string.lower(row["conference_room_uuid"]); conference_room_uuid = string.lower(row["conference_room_uuid"]);
conference_room_name = string.lower(row["conference_room_name"]); conference_room_name = string.lower(row["conference_room_name"]);
meeting_uuid = string.lower(row["meeting_uuid"]); --meeting_uuid = string.lower(row["meeting_uuid"]);
record = string.lower(row["record"]); record = string.lower(row["record"]);
profile = string.lower(row["profile"]); profile = string.lower(row["profile"]);
max_members = row["max_members"]; max_members = row["max_members"];
@ -612,204 +595,203 @@
session:setVariable("meeting_uuid", meeting_uuid); session:setVariable("meeting_uuid", meeting_uuid);
end end
if (meeting_uuid == nil) then --check if the conference exists
--invalid pin number cmd = "conference "..conference_room_uuid.."@"..domain_name.." xml_list";
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-bad-pin.wav"); result = trim(api:executeString(cmd));
session:hangup("NORMAL_CLEARING"); if (string.sub(result, -9) == "not found") then
else conference_exists = false;
if (meeting_uuid) then else
--check if the conference exists conference_exists = true;
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
result = trim(api:executeString(cmd));
if (string.sub(result, -9) == "not found") then
conference_exists = false;
else
conference_exists = true;
end
--check if the conference is locked
if (string.find(result, [[locked="true"]]) == nil) then
conference_locked = false;
else
conference_locked = true;
end
--set a conference parameter
if (max_members ~= nil) then
if (tonumber(max_members) > 0) then
--max members must be 2 or more
session:execute("set","conference_max_members="..max_members);
if (conference_exists) then
cmd = "conference "..meeting_uuid.."@"..domain_name.." get count";
count = trim(api:executeString(cmd));
if (count ~= nil) then
if (tonumber(count) >= tonumber(max_members)) then
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-locked.wav");
session:hangup("CALL_REJECTED");
end
end
end
end
end
--announce the caller
if (conference_locked) then
announce = "false";
end
if (announce_name == "true") then
--prompt for the name of the caller
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-say_name.wav");
session:execute("playback", "tone_stream://v=-7;%%(500,0,500.0)");
--record the response
max_len_seconds = 5;
silence_threshold = "500";
silence_secs = "3";
session:recordFile(temp_dir:gsub("\\","/") .. "/conference-"..uuid..".wav", max_len_seconds, silence_threshold, silence_secs);
end
--play a message that the conference is being a recorded
--if (record == "true") then
--session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
--end
--wait for moderator
if (wait_mod == "true") then
if (conference_exists) then
--continue
else
if (member_type == "participant") then
profile = "wait-mod";
end
end
end
--set the exit sound
if (sounds == "true") then
session:execute("set","conference_exit_sound="..exit_sound);
else
session:execute("set","conference_enter_sound=none");
session:execute("set","conference_exit_sound=none");
end
--set flags and moderator controls
if (wait_mod == "true") then
if (member_type == "participant") then
flags = flags .. "wait-mod";
end
end
if (mute == "true") then
if (member_type == "participant") then
flags = flags .. "|mute";
end
end
if (member_type == "moderator") then
--set as the moderator
flags = flags .. "|moderator";
--when the moderator leaves end the conference
if (moderator_endconf == "true") then
flags = flags .. "|endconf";
end
end
--get the conference xml_list
cmd = "conference "..meeting_uuid.."@"..domain_name.." xml_list";
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
result = trim(api:executeString(cmd));
--get the content to the <conference> tag
result = string.match(result,[[<conference (.-)>]],1);
--get the uuid out of the xml tag contents
if (result ~= nil) then
conference_session_uuid = string.match(result,[[uuid="(.-)"]],1);
end
--log entry
if (conference_session_uuid ~= nil) then
freeswitch.consoleLog("INFO","conference_session_uuid: " .. conference_session_uuid .. "\n");
end
--set the start epoch
start_epoch = os.time();
--set the recording variable
if (conference_session_uuid ~= nil) then
if (record == "true") then
recordings_dir_2 = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
mkdir(recordings_dir_2);
recording = recordings_dir_2.."/"..conference_session_uuid;
session:execute("set","recording="..recording);
session:execute("set","conference_session_uuid="..conference_session_uuid);
end
end
--record the conference
if (announce_recording == "true") then
if (record == "true") then
--play a message that the conference is being a recorded
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
--play a message that the conference is being a recorded
--cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
--response = api:executeString(cmd);
end
end
--announce the caller
if (announce_name == "true") then
--announce the caller - play the recording
cmd = "conference "..meeting_uuid.."@"..domain_name.." play " .. temp_dir:gsub("\\", "/") .. "/conference-"..uuid..".wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
response = api:executeString(cmd);
--play has entered the conference
cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-has_joined.wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
response = api:executeString(cmd);
else
if (not conference_locked) then
if (sounds == "true") then
cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..enter_sound;
response = api:executeString(cmd);
end
end
end
--get the conference member count
cmd = "conference "..meeting_uuid.."@"..domain_name.." list count";
--freeswitch.consoleLog("notice", "[conference center] cmd: ".. cmd .."\n");
member_count = api:executeString(cmd);
if (string.sub(trim(member_count), -9) == "not found") then
member_count = "0";
end
--play member count
if (announce_count == "true") then
if (member_count == "1") then
--there is one other member in this conference
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-one_other_member_conference.wav");
elseif (member_count == "0") then
--conference profile defines the alone sound file
else
--say the count
session:execute("say", default_language.." number pronounced "..member_count);
--members in this conference
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-members_in_conference.wav");
end
end
--record the conference
if (record == "true") then
if (wait_mod == "true" and member_type ~= "moderator") then
--don't start recording yet
else
cmd="sched_api +3 none lua "..scripts_dir.."/app/conference_center/resources/scripts/start_recording.lua "..meeting_uuid.." "..domain_name.." "..record_ext;
api:executeString(cmd);
end
end
--send the call to the conference
cmd = meeting_uuid.."@"..domain_name.."@"..profile.."+flags{".. flags .."}";
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
session:execute("conference", cmd);
end end
end
--check if the conference is locked
if (string.find(result, [[locked="true"]]) == nil) then
conference_locked = false;
else
conference_locked = true;
end
--set a conference parameter
if (max_members ~= nil) then
if (tonumber(max_members) > 0) then
--max members must be 2 or more
session:execute("set","conference_max_members="..max_members);
if (conference_exists) then
cmd = "conference "..conference_room_uuid.."@"..domain_name.." get count";
count = trim(api:executeString(cmd));
if (count ~= nil) then
if (tonumber(count) >= tonumber(max_members)) then
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-locked.wav");
session:hangup("CALL_REJECTED");
end
end
end
end
end
--announce the caller
if (conference_locked) then
announce = "false";
end
if (announce_name == "true") then
--prompt for the name of the caller
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-say_name.wav");
session:execute("playback", "tone_stream://v=-7;%%(500,0,500.0)");
--record the response
max_len_seconds = 5;
silence_threshold = "500";
silence_secs = "3";
session:recordFile(temp_dir:gsub("\\","/") .. "/conference-"..uuid..".wav", max_len_seconds, silence_threshold, silence_secs);
end
--play a message that the conference is being a recorded
--if (record == "true") then
--session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
--end
--wait for moderator
if (wait_mod == "true") then
if (conference_exists) then
--continue
else
if (member_type == "participant") then
profile = "wait-mod";
end
end
end
--set the exit sound
if (sounds == "true") then
session:execute("set","conference_exit_sound="..exit_sound);
else
session:execute("set","conference_enter_sound=none");
session:execute("set","conference_exit_sound=none");
end
--set flags and moderator controls
if (wait_mod == "true") then
if (member_type == "participant") then
flags = flags .. "wait-mod";
end
end
if (mute == "true") then
if (member_type == "participant") then
flags = flags .. "|mute";
end
end
if (member_type == "moderator") then
--set as the moderator
flags = flags .. "|moderator";
--when the moderator leaves end the conference
if (moderator_endconf == "true") then
flags = flags .. "|endconf";
end
end
--get the conference xml_list
cmd = "conference "..conference_room_uuid.."@"..domain_name.." xml_list";
freeswitch.consoleLog("INFO","" .. cmd .. "\n");
result = trim(api:executeString(cmd));
--get the content to the <conference> tag
result = string.match(result,[[<conference (.-)>]],1);
--get the uuid out of the xml tag contents
if (result ~= nil) then
conference_session_uuid = string.match(result,[[uuid="(.-)"]],1);
end
--log entry
if (conference_session_uuid ~= nil) then
freeswitch.consoleLog("INFO","conference_session_uuid: " .. conference_session_uuid .. "\n");
end
--set the start epoch
start_epoch = os.time();
--set the recording variable
if (conference_session_uuid ~= nil) then
if (record == "true") then
recordings_dir_2 = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
mkdir(recordings_dir_2);
recording = recordings_dir_2.."/"..conference_session_uuid;
session:execute("set","recording="..recording);
session:execute("set","conference_session_uuid="..conference_session_uuid);
end
end
--record the conference
if (announce_recording == "true") then
if (record == "true") then
--play a message that the conference is being a recorded
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
--play a message that the conference is being a recorded
--cmd = "conference "..meeting_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
--response = api:executeString(cmd);
end
end
--announce the caller
if (announce_name == "true") then
--announce the caller - play the recording
cmd = "conference "..conference_room_uuid.."@"..domain_name.." play " .. temp_dir:gsub("\\", "/") .. "/conference-"..uuid..".wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
response = api:executeString(cmd);
--play has entered the conference
cmd = "conference "..conference_room_uuid.."@"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-has_joined.wav";
--freeswitch.consoleLog("notice", "[conference center] ".. cmd .."\n");
response = api:executeString(cmd);
else
if (not conference_locked) then
if (sounds == "true") then
cmd = "conference "..conference_room_uuid.."@"..domain_name.." play "..enter_sound;
response = api:executeString(cmd);
end
end
end
--get the conference member count
cmd = "conference "..conference_room_uuid.."@"..domain_name.." list count";
--freeswitch.consoleLog("notice", "[conference center] cmd: ".. cmd .."\n");
member_count = api:executeString(cmd);
if (string.sub(trim(member_count), -9) == "not found") then
member_count = "0";
end
--play member count
if (announce_count == "true") then
if (member_count == "1") then
--there is one other member in this conference
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-one_other_member_conference.wav");
elseif (member_count == "0") then
--conference profile defines the alone sound file
else
--say the count
session:execute("say", default_language.." number pronounced "..member_count);
--members in this conference
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-members_in_conference.wav");
end
end
--record the conference
if (record == "true") then
if (wait_mod == "true" and member_type ~= "moderator") then
--don't start recording yet
else
cmd="sched_api +3 none lua "..scripts_dir.."/app/conference_center/resources/scripts/start_recording.lua "..conference_room_uuid.." "..domain_name.." "..record_ext;
api:executeString(cmd);
end
end
--use default profile if not provided
if (profile == null) then
profile = 'default';
end
--send the call to the conference
cmd = conference_room_uuid.."@"..domain_name.."@"..profile.."+flags{".. flags .."}";
freeswitch.consoleLog("INFO","[conference center] conference " .. cmd .. "\n");
session:execute("conference", cmd);
end end