Change kick and kick all to uuid_kill so that the participant's call is logged to the database. Fix recordings and the announce that the call is being recorded for the first person to join the conference. Add a permission to control the conference session 'details' column in the conference sessions so CDR link can be hidden from the user. Don't allow a conference moderator and participant to use the same pin number.

This commit is contained in:
Mark Crane
2013-03-15 17:12:13 +00:00
parent 9324381578
commit 9c896e0e23
8 changed files with 128 additions and 67 deletions

View File

@@ -85,6 +85,10 @@
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$apps[$x]['permissions'][$y]['groups'][] = 'user';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'conference_session_details';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'conference_room_profile';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin';

View File

@@ -179,7 +179,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($moderator_pin) > 0) {
$sql = "select count(*) as num_rows from v_meeting_pins ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and meeting_uuid <> '".$meeting_uuid."' ";
//$sql .= "and meeting_uuid = '".$meeting_uuid."' ";
$sql .= "and member_pin = '".$moderator_pin."' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
@@ -191,7 +191,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
}
$sql = "select count(*) as num_rows from v_meeting_pins ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and meeting_uuid <> '".$meeting_uuid."' ";
//$sql .= "and meeting_uuid = '".$meeting_uuid."' ";
$sql .= "and member_pin = '".$participant_pin."' ";
$prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) {
@@ -201,11 +201,14 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg .= "Please provide a unique participant pin number.<br>\n";
}
}
if ($moderator_pin == $participant_pin) {
$msg .= "Moderator and Participant PIN number must be unique.\n";
}
if (strlen($moderator_pin) != $pin_length) {
$msg .= "Please provide a moderator PIN number that is the required length\n";
$msg .= "Please provide a moderator PIN number that is the required length.\n";
}
if (strlen($participant_pin) != $pin_length) {
$msg .= "Please provide a participant PIN number that is the required length\n";
$msg .= "Please provide a participant PIN number that is the required length.\n";
}
}

View File

@@ -177,7 +177,9 @@ else {
echo "<th>".$text['label-time']."</th>\n";
echo th_order_by('start_epoch', $text['label-start'], $order_by, $order);
echo th_order_by('end_epoch', $text['label-end'], $order_by, $order);
echo "<th>".$text['label-details']."</th>\n";
if (permission_exists('conference_session_details')) {
echo "<th>".$text['label-details']."</th>\n";
}
echo "<tr>\n";
if ($result_count > 0) {
@@ -204,7 +206,9 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".$time_difference."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'><a href='/app/xml_cdr/xml_cdr_details.php?uuid=".$row['uuid']."'>".$text['label-cdr']."</a>&nbsp;</td>\n";
if (permission_exists('conference_session_details')) {
echo " <td valign='top' class='".$row_style[$c]."'><a href='/app/xml_cdr/xml_cdr_details.php?uuid=".$row['uuid']."'>".$text['label-cdr']."</a>&nbsp;</td>\n";
}
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach

View File

@@ -147,35 +147,37 @@ else {
$time_difference = gmdate("G:i:s", $time_difference);
}
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$time_difference."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['profile']."&nbsp;</td>\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) {
$tmp_name = $row['conference_session_uuid'].".mp3";
}
elseif (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.wav')) {
$tmp_name = $row['conference_session_uuid'].".wav";
}
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo " <a href='conference_session_details.php?uuid=".$row['conference_session_uuid']."'>".$text['label-details']."</a>&nbsp;\n";
if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name)) {
if (permission_exists('conference_session_play')) {
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('".PROJECT_PATH."/app/recordings/recordings_play.php?a=download&type=moh&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no')\">\n";
echo " ".$text['label-play']."\n";
if (strlen( $row['start_epoch']) > 0) {
echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$time_difference."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['profile']."&nbsp;</td>\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
$tmp_name = '';
if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) {
$tmp_name = $row['conference_session_uuid'].".mp3";
}
elseif (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.wav')) {
$tmp_name = $row['conference_session_uuid'].".wav";
}
echo " <td valign='top' class='".$row_style[$c]."'>\n";
echo " <a href='conference_session_details.php?uuid=".$row['conference_session_uuid']."'>".$text['label-details']."</a>&nbsp;\n";
if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name)) {
if (permission_exists('conference_session_play')) {
echo " <a href=\"javascript:void(0);\" onclick=\"window.open('".PROJECT_PATH."/app/recordings/recordings_play.php?a=download&type=moh&filename=".base64_encode('archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day.'/'.$tmp_name)."', 'play',' width=420,height=150,menubar=no,status=no,toolbar=no')\">\n";
echo " ".$text['label-play']."\n";
echo " </a>\n";
echo " &nbsp;\n";
}
echo " <a href=\"../recordings/recordings.php?a=download&type=rec&t=bin&filename=".base64_encode("archive/".$tmp_year."/".$tmp_month."/".$tmp_day."/".$tmp_name)."\">\n";
echo " ".$text['label-download']."\n";
echo " </a>\n";
echo " &nbsp;\n";
}
echo " <a href=\"../recordings/recordings.php?a=download&type=rec&t=bin&filename=".base64_encode("archive/".$tmp_year."/".$tmp_month."/".$tmp_day."/".$tmp_name)."\">\n";
echo " ".$text['label-download']."\n";
echo " </a>\n";
echo " &nbsp;\n";
echo " </td>\n";
echo "</tr>\n";
}
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; }
} //end foreach
unset($sql, $result, $row_count);

View File

@@ -74,6 +74,30 @@ else {
exit;
}
//define an alternative kick all
function conference_end($fp, $name) {
$switch_cmd = "conference '".$name."' xml_list";
$xml_str = trim(event_socket_request($fp, 'api '.$switch_cmd));
try {
$xml = new SimpleXMLElement($xml_str);
}
catch(Exception $e) {
//echo $e->getMessage();
}
$session_uuid = $xml->conference['uuid'];
$x = 0;
foreach ($xml->conference->members->member as $row) {
$switch_result = event_socket_request($fp, 'api uuid_kill '.$row->uuid);
if ($x < 1) {
usleep(500000); //500000 = 0.5 seconds
}
else {
usleep(10000); //1000000 = 0.01 seconds
}
$x++;
}
}
//execute the command
if (count($_GET) > 0) {
if (strlen($cmd) > 0) {
@@ -129,8 +153,12 @@ else {
$switch_cmd .= $recording_dir."/".$uuid.".wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
elseif ($data == "kick" || $data == "kick all") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
elseif ($data == "kick") {
$switch_result = event_socket_request($fp, 'api uuid_kill '.$uuid);
}
elseif ($data == "kick all") {
//$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
conference_end($fp, $name);
}
elseif ($data == "mute" || $data == "unmute" || $data == "mute non_moderator" || $data == "unmute non_moderator") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);

View File

@@ -268,7 +268,7 @@ else {
}
//kick someone from the conference
if (permission_exists('conferences_active_kick')) {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&data=kick&id=".$id."');\">".$text['label-kick']."</a>&nbsp;\n";
echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&data=kick&id=".$id."&uuid=".$uuid."');\">".$text['label-kick']."</a>&nbsp;\n";
}
echo " &nbsp;";
echo "</td>\n";

View File

@@ -779,6 +779,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and u.user_enabled = 'true' ";
$sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and e.extension_uuid = '".$extension_uuid."' ";
$sql .= "order by u.username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
@@ -797,6 +798,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_enabled = 'true' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
echo " <select name=\"user_uuid\" class='frm'>\n";

View File

@@ -36,7 +36,7 @@
end
--FreeSWITCH core db handler
if (db_type == "sqlite") then
dbh = freeswitch.Dbh("core:"..db_path.."/"..db_name);
dbh = freeswitch.Dbh("sqlite://"..db_path.."/"..db_name);
end
--prepare the api object
@@ -277,15 +277,19 @@
AND u.user_uuid = m.user_uuid
AND m.meeting_uuid = ']] .. meeting_uuid ..[['
and u.contact_uuid = c.contact_uuid]];
-- if (debug["sql"]) then
if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference] <email> SQL: " .. sql .. "\n");
-- end
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] contact_email: " .. contact_email .. "\n");
send_email(contact_email, "", default_language, default_dialect);
if (record == "true") then
if (file_exists(conference_recording..".wav")) then
send_email(contact_email, "", default_language, default_dialect);
end
end
end
end
end);
@@ -295,12 +299,17 @@
--make sure the session is ready
if (session:ready()) then
session:answer();
session:setHangupHook("session_hangup_hook");
sounds_dir = session:getVariable("sounds_dir");
hold_music = session:getVariable("hold_music");
domain_name = session:getVariable("domain_name");
pin_number = session:getVariable("pin_number");
--answer the call
session:answer();
--set the hangup hook function
session:setHangupHook("session_hangup_hook");
--get session variables
sounds_dir = session:getVariable("sounds_dir");
hold_music = session:getVariable("hold_music");
domain_name = session:getVariable("domain_name");
pin_number = session:getVariable("pin_number");
--get the domain_uuid
if (domain_name ~= nil) then
@@ -328,8 +337,8 @@
if (not default_voice) then default_voice = 'callie'; end
--sounds
enter_sound = "tone_stream://%(200,0,500,600,700)";
exit_sound = "tone_stream://%(500,0,300,200,100,50,25)";
enter_sound = "tone_stream://v=-20;%(100,1000,100);v=-20;%(90,60,440);%(90,60,620)";
exit_sound = "tone_stream://v=-20;%(90,60,620);/%(90,60,440)";
--get the variables
username = session:getVariable("username");
@@ -374,8 +383,15 @@
end
end
--get the pin
pin_number = get_pin_number(domain_uuid);
--get the pin
pin_number = session:getVariable("pin_number");
if (not pin_number) then
pin_number = nil;
pin_number = get_pin_number(domain_uuid);
end
if (pin_number == nil) then
pin_number = get_pin_number(domain_uuid);
end
if (pin_number == nil) then
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-bad-pin.wav");
pin_number = get_pin_number(domain_uuid);
@@ -536,26 +552,31 @@
--set the recording variable
if (conference_session_uuid ~= nil) then
recording = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch) .."/"..conference_session_uuid;
--session:execute("set","recording="..recording);
if (record == "true") then
recordings_dir = recordings_dir.."/archive/"..os.date("%Y", start_epoch).."/"..os.date("%b", start_epoch).."/"..os.date("%d", start_epoch);
os.execute("mkdir -p " .. recordings_dir);
recording = recordings_dir.."/"..conference_session_uuid;
session:execute("set","recording="..recording);
end
end
--record the conference
if (record == "true") then
if (conference_exists) then
--send a command to record the conference
if (not file_exists(recording..".wav")) then
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
freeswitch.consoleLog("notice", "[conference] cmd: " .. cmd .. "\n");
response = api:executeString(cmd);
end
--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] ".. cmd .."\n");
--response = api:executeString(cmd);
end
--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] ".. cmd .."\n");
--response = api:executeString(cmd);
--record the conference when it exists
if (conference_exists) then
--send a command to record the conference
if (not file_exists(recording..".wav")) then
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
freeswitch.consoleLog("notice", "[conference] cmd: " .. cmd .. "\n");
response = api:executeString(cmd);
end
end
end
--announce the caller
@@ -577,9 +598,6 @@
end
end
--set the hangup hook function
session:setHangupHook("session_hangup_hook");
--send the call to the conference
profile = "default";
cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}";