Get the uuid and record, use both to improve recordings.

This commit is contained in:
Mark Crane
2012-10-27 02:01:36 +00:00
parent 3f7e00bf81
commit 012e7e8b9b
2 changed files with 55 additions and 35 deletions
+9 -9
View File
@@ -41,6 +41,7 @@ else {
if (count($_GET)>0) { if (count($_GET)>0) {
$cmd = trim(check_str($_GET["cmd"])); $cmd = trim(check_str($_GET["cmd"]));
$name = trim(check_str($_GET["name"])); $name = trim(check_str($_GET["name"]));
$uuid = trim(check_str($_GET["uuid"]));
$data = trim(check_str($_GET["data"])); $data = trim(check_str($_GET["data"]));
$id = trim(check_str($_GET["id"])); $id = trim(check_str($_GET["id"]));
$direction = trim(check_str($_GET["direction"])); $direction = trim(check_str($_GET["direction"]));
@@ -103,22 +104,21 @@ if (count($_GET)>0) {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value); $switch_result = event_socket_request($fp, 'api '.$switch_cmd.' '.$tmp_value);
} }
elseif ($data == "record") { elseif ($data == "record") {
$switch_cmd .= $_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav"; $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
if (!file_exists($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav")) { $switch_cmd .= $recording_dir."/".$uuid.".wav";
if (!file_exists($recording_dir."/".$uuid.".wav")) {
$switch_result = event_socket_request($fp, "api ".$switch_cmd); $switch_result = event_socket_request($fp, "api ".$switch_cmd);
} }
} }
elseif ($data == "norecord") { elseif ($data == "norecord") {
//stop recording and rename the file //stop recording and rename the file
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav")) { $recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
rename($_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav", $_SESSION['switch']['recordings']['dir']."/".$name."-".date("Y").".".date("M").".".date("d")."-".uuid().".wav"); $switch_cmd .= $recording_dir."/".$uuid.".wav";
}
$switch_cmd .= $_SESSION['switch']['recordings']['dir']."/".$name."-tmp.wav";
$switch_result = event_socket_request($fp, 'api '.$switch_cmd);
}
else {
$switch_result = event_socket_request($fp, 'api '.$switch_cmd); $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
} }
//else {
// $switch_result = event_socket_request($fp, 'api '.$switch_cmd);
//}
} }
} }
} }
@@ -43,32 +43,32 @@ else {
} }
else { else {
//get the conference_uuid from the coference_name //get the conference_uuid from the coference_name
$sql = "select conference_uuid from v_conferences "; $sql = "select conference_uuid from v_conferences ";
$sql .= "where conference_name = '".$conference_name."' "; $sql .= "where conference_name = '".$conference_name."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
$prep_statement->execute(); $prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
$conference_uuid = $row['conference_uuid']; $conference_uuid = $row['conference_uuid'];
} }
//show only assigned extensions //show only assigned extensions
$sql = "select count(*) as num_rows from v_conferences as c, v_conference_users as u "; $sql = "select count(*) as num_rows from v_conferences as c, v_conference_users as u ";
$sql .= "where c.conference_uuid = u.conference_uuid "; $sql .= "where c.conference_uuid = u.conference_uuid ";
$sql .= "and c.conference_uuid = '".$conference_uuid."' "; $sql .= "and c.conference_uuid = '".$conference_uuid."' ";
$sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and c.domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' "; $sql .= "and u.user_uuid = '".$_SESSION['user_uuid']."' ";
if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; } if (strlen($order_by)> 0) { $sql .= "order by $order_by $order "; }
$prep_statement = $db->prepare($sql); $prep_statement = $db->prepare($sql);
if ($prep_statement) { if ($prep_statement) {
$prep_statement->execute(); $prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_ASSOC); $row = $prep_statement->fetch(PDO::FETCH_ASSOC);
if ($row['num_rows'] == 0) { if ($row['num_rows'] == 0) {
echo "access denied"; echo "access denied";
exit; exit;
}
} }
}
} }
//replace the space with underscore //replace the space with underscore
@@ -102,8 +102,10 @@ else {
//echo $e->getMessage(); //echo $e->getMessage();
} }
//$name = $xml->conference['name']; //$name = $xml->conference['name'];
$session_uuid = $xml->conference['uuid'];
$member_count = $xml->conference['member-count']; $member_count = $xml->conference['member-count'];
$locked = $xml->conference['locked']; $locked = $xml->conference['locked'];
$recording = $xml->conference['recording'];
$c = 0; $c = 0;
$row_style["0"] = "row_style0"; $row_style["0"] = "row_style0";
@@ -124,12 +126,30 @@ else {
if (permission_exists('conferences_active_record') || permission_exists('conferences_active_lock')) { if (permission_exists('conferences_active_record') || permission_exists('conferences_active_lock')) {
echo " <strong>Conference Tools:</strong> \n"; echo " <strong>Conference Tools:</strong> \n";
} }
$recording_dir = $_SESSION['switch']['recordings']['dir'].'/archive/'.date("Y").'/'.date("M").'/'.date("d");
$recording_name = '';
if (file_exists($recording_dir.'/'.$row['uuid'].'.wav')) {
$recording_name = $session_uuid.".wav";
}
elseif (file_exists($recording_dir.'/'.$row['uuid'].'.mp3')) {
$recording_name = $session_uuid.".mp3";
}
if (permission_exists('conferences_active_record')) { if (permission_exists('conferences_active_record')) {
if (file_exists($_SESSION['switch']['recordings']['dir']."/".$conference_name."-tmp.wav")) { if ($recording == "true") {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&data=norecord');\">Stop Record</a>&nbsp;\n"; echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&uuid=".$session_uuid."&data=norecord');\">Stop Record</a>&nbsp;\n";
} }
else { else {
echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&data=record');\">Start Record</a>&nbsp;\n"; echo " <a href='javascript:void(0);' onclick=\"send_cmd('conference_exec.php?cmd=conference&name=".$conference_name."&uuid=".$session_uuid."&data=record');\">Start Record</a>&nbsp;\n";
}
}
else {
if ($recording == "true") {
echo " Recording &nbsp;";
}
else {
echo " Not Recording &nbsp;";
} }
} }
if (permission_exists('conferences_active_lock')) { if (permission_exists('conferences_active_lock')) {