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 16223677ef
commit faeee96624
8 changed files with 128 additions and 67 deletions
+4
View File
@@ -85,6 +85,10 @@
$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin';
$apps[$x]['permissions'][$y]['groups'][] = 'user'; $apps[$x]['permissions'][$y]['groups'][] = 'user';
$y++; $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]['name'] = 'conference_room_profile';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin'; $apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$apps[$x]['permissions'][$y]['groups'][] = 'admin'; $apps[$x]['permissions'][$y]['groups'][] = 'admin';
@@ -179,7 +179,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($moderator_pin) > 0) { if (strlen($moderator_pin) > 0) {
$sql = "select count(*) as num_rows from v_meeting_pins "; $sql = "select count(*) as num_rows from v_meeting_pins ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $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."' "; $sql .= "and member_pin = '".$moderator_pin."' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) { 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 = "select count(*) as num_rows from v_meeting_pins ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $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."' "; $sql .= "and member_pin = '".$participant_pin."' ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
if ($prep_statement) { 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"; $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) { 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) { 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";
} }
} }
@@ -177,7 +177,9 @@ else {
echo "<th>".$text['label-time']."</th>\n"; echo "<th>".$text['label-time']."</th>\n";
echo th_order_by('start_epoch', $text['label-start'], $order_by, $order); 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_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"; echo "<tr>\n";
if ($result_count > 0) { 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]."'>".$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]."'>".$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]."'>".$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"; echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; } if ($c==0) { $c=1; } else { $c=0; }
} //end foreach } //end foreach
+27 -25
View File
@@ -147,35 +147,37 @@ else {
$time_difference = gmdate("G:i:s", $time_difference); $time_difference = gmdate("G:i:s", $time_difference);
} }
echo "<tr >\n"; if (strlen( $row['start_epoch']) > 0) {
echo " <td valign='top' class='".$row_style[$c]."'>".$time_difference."&nbsp;</td>\n"; echo "<tr >\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$time_difference."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$start_date."&nbsp;</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>".$row['profile']."&nbsp;</td>\n"; echo " <td valign='top' class='".$row_style[$c]."'>".$end_date."&nbsp;</td>\n";
$tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day; echo " <td valign='top' class='".$row_style[$c]."'>".$row['profile']."&nbsp;</td>\n";
$tmp_name = ''; $tmp_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.$tmp_year.'/'.$tmp_month.'/'.$tmp_day;
if (file_exists($tmp_dir.'/'.$row['conference_session_uuid'].'.mp3')) { $tmp_name = '';
$tmp_name = $row['conference_session_uuid'].".mp3"; 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"; 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"; echo " <td valign='top' class='".$row_style[$c]."'>\n";
if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name)) { echo " <a href='conference_session_details.php?uuid=".$row['conference_session_uuid']."'>".$text['label-details']."</a>&nbsp;\n";
if (permission_exists('conference_session_play')) { if (strlen($tmp_name) > 0 && file_exists($tmp_dir.'/'.$tmp_name)) {
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"; if (permission_exists('conference_session_play')) {
echo " ".$text['label-play']."\n"; 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 " </a>\n";
echo " &nbsp;\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 " </td>\n";
echo " ".$text['label-download']."\n"; echo "</tr>\n";
echo " </a>\n";
echo " &nbsp;\n";
} }
echo " </td>\n";
echo "</tr>\n";
if ($c==0) { $c=1; } else { $c=0; } if ($c==0) { $c=1; } else { $c=0; }
} //end foreach } //end foreach
unset($sql, $result, $row_count); unset($sql, $result, $row_count);
+30 -2
View File
@@ -74,6 +74,30 @@ else {
exit; 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 //execute the command
if (count($_GET) > 0) { if (count($_GET) > 0) {
if (strlen($cmd) > 0) { if (strlen($cmd) > 0) {
@@ -129,8 +153,12 @@ else {
$switch_cmd .= $recording_dir."/".$uuid.".wav"; $switch_cmd .= $recording_dir."/".$uuid.".wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
} }
elseif ($data == "kick" || $data == "kick all") { elseif ($data == "kick") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $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") { elseif ($data == "mute" || $data == "unmute" || $data == "mute non_moderator" || $data == "unmute non_moderator") {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
@@ -268,7 +268,7 @@ else {
} }
//kick someone from the conference //kick someone from the conference
if (permission_exists('conferences_active_kick')) { 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 " &nbsp;";
echo "</td>\n"; echo "</td>\n";
+2
View File
@@ -779,6 +779,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "and u.user_enabled = 'true' "; $sql .= "and u.user_enabled = 'true' ";
$sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and e.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and e.extension_uuid = '".$extension_uuid."' "; $sql .= "and e.extension_uuid = '".$extension_uuid."' ";
$sql .= "order by u.username asc ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $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 = "SELECT * FROM v_users ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and user_enabled = 'true' "; $sql .= "and user_enabled = 'true' ";
$sql .= "order by username asc ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute(); $prep_statement->execute();
echo " <select name=\"user_uuid\" class='frm'>\n"; echo " <select name=\"user_uuid\" class='frm'>\n";
@@ -36,7 +36,7 @@
end end
--FreeSWITCH core db handler --FreeSWITCH core db handler
if (db_type == "sqlite") then if (db_type == "sqlite") then
dbh = freeswitch.Dbh("core:"..db_path.."/"..db_name); dbh = freeswitch.Dbh("sqlite://"..db_path.."/"..db_name);
end end
--prepare the api object --prepare the api object
@@ -277,15 +277,19 @@
AND u.user_uuid = m.user_uuid AND u.user_uuid = m.user_uuid
AND m.meeting_uuid = ']] .. meeting_uuid ..[[' AND m.meeting_uuid = ']] .. meeting_uuid ..[['
and u.contact_uuid = c.contact_uuid]]; and u.contact_uuid = c.contact_uuid]];
-- if (debug["sql"]) then if (debug["sql"]) then
freeswitch.consoleLog("notice", "[conference] <email> SQL: " .. sql .. "\n"); freeswitch.consoleLog("notice", "[conference] <email> SQL: " .. sql .. "\n");
-- end end
status = dbh:query(sql, function(row) status = dbh:query(sql, function(row)
if (row["contact_email"] ~= nil) then if (row["contact_email"] ~= nil) then
contact_email = string.lower(row["contact_email"]); contact_email = string.lower(row["contact_email"]);
if (string.len(contact_email) > 3) then if (string.len(contact_email) > 3) then
freeswitch.consoleLog("notice", "[conference] contact_email: " .. contact_email .. "\n"); 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 end
end); end);
@@ -295,12 +299,17 @@
--make sure the session is ready --make sure the session is ready
if (session:ready()) then if (session:ready()) then
session:answer(); --answer the call
session:setHangupHook("session_hangup_hook"); session:answer();
sounds_dir = session:getVariable("sounds_dir");
hold_music = session:getVariable("hold_music"); --set the hangup hook function
domain_name = session:getVariable("domain_name"); session:setHangupHook("session_hangup_hook");
pin_number = session:getVariable("pin_number");
--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 --get the domain_uuid
if (domain_name ~= nil) then if (domain_name ~= nil) then
@@ -328,8 +337,8 @@
if (not default_voice) then default_voice = 'callie'; end if (not default_voice) then default_voice = 'callie'; end
--sounds --sounds
enter_sound = "tone_stream://%(200,0,500,600,700)"; enter_sound = "tone_stream://v=-20;%(100,1000,100);v=-20;%(90,60,440);%(90,60,620)";
exit_sound = "tone_stream://%(500,0,300,200,100,50,25)"; exit_sound = "tone_stream://v=-20;%(90,60,620);/%(90,60,440)";
--get the variables --get the variables
username = session:getVariable("username"); username = session:getVariable("username");
@@ -374,8 +383,15 @@
end end
end end
--get the pin --get the pin
pin_number = get_pin_number(domain_uuid); 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 if (pin_number == nil) then
session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-bad-pin.wav"); session:streamFile(sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/conference/conf-bad-pin.wav");
pin_number = get_pin_number(domain_uuid); pin_number = get_pin_number(domain_uuid);
@@ -536,26 +552,31 @@
--set the recording variable --set the recording variable
if (conference_session_uuid ~= nil) then 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; if (record == "true") then
--session:execute("set","recording="..recording); 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 end
--record the conference --record the conference
if (record == "true") then if (record == "true") then
if (conference_exists) then --play a message that the conference is being a recorded
--send a command to record the conference session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav");
if (not file_exists(recording..".wav")) then --play a message that the conference is being a recorded
cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav"; --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: " .. cmd .. "\n"); --freeswitch.consoleLog("notice", "[conference] ".. cmd .."\n");
response = api:executeString(cmd); --response = api:executeString(cmd);
end --record the conference when it exists
--play a message that the conference is being a recorded if (conference_exists) then
session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav"); --send a command to record the conference
--play a message that the conference is being a recorded if (not file_exists(recording..".wav")) then
--cmd = "conference "..meeting_uuid.."-"..domain_name.." play "..sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/ivr/ivr-recording_started.wav"; cmd = "conference "..meeting_uuid.."-"..domain_name.." record "..recording..".wav";
--freeswitch.consoleLog("notice", "[conference] ".. cmd .."\n"); freeswitch.consoleLog("notice", "[conference] cmd: " .. cmd .. "\n");
--response = api:executeString(cmd); response = api:executeString(cmd);
end end
end
end end
--announce the caller --announce the caller
@@ -577,9 +598,6 @@
end end
end end
--set the hangup hook function
session:setHangupHook("session_hangup_hook");
--send the call to the conference --send the call to the conference
profile = "default"; profile = "default";
cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}"; cmd = meeting_uuid.."-"..domain_name.."@"..profile.."+flags{".. flags .."}";