Add toggle for when to create recording

This commit is contained in:
FusionPBX 2024-07-23 12:09:50 -06:00 committed by GitHub
parent 12a862217f
commit ac9497c232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 115 additions and 21 deletions

View File

@ -5,7 +5,7 @@
$apps[$x]['uuid'] = "83913217-c7a2-9e90-925d-a866eb40b60e";
$apps[$x]['category'] = "Switch";;
$apps[$x]['subcategory'] = "";
$apps[$x]['version'] = "1.0";
$apps[$x]['version'] = "1.1";
$apps[$x]['license'] = "Mozilla Public License 1.1";
$apps[$x]['url'] = "http://www.fusionpbx.com";
$apps[$x]['description']['en-us'] = "Manage recordings primarily used with an IVR.";

View File

@ -650,31 +650,83 @@ $text['description-message']['zh-cn'] = "录音消息。";
$text['description-message']['ja-jp'] = "録音メッセージ。";
$text['description-message']['ko-kr'] = "녹음 메시지입니다.";
$text['description-recording']['en-us'] = "A name for the recording (not parsed).";
$text['description-recording']['en-gb'] = "A name for the recording (not parsed).";
$text['label-create_recording']['en-us'] = "Update";
$text['label-create_recording']['en-gb'] = "Update";
$text['label-create_recording']['ar-eg'] = "";
$text['label-create_recording']['de-at'] = "";
$text['label-create_recording']['de-ch'] = "";
$text['label-create_recording']['de-de'] = "";
$text['label-create_recording']['el-gr'] = "";
$text['label-create_recording']['es-cl'] = "";
$text['label-create_recording']['es-mx'] = "";
$text['label-create_recording']['fr-ca'] = "";
$text['label-create_recording']['fr-fr'] = "";
$text['label-create_recording']['he-il'] = "";
$text['label-create_recording']['it-it'] = "";
$text['label-create_recording']['nl-nl'] = "";
$text['label-create_recording']['pl-pl'] = "";
$text['label-create_recording']['pt-br'] = "";
$text['label-create_recording']['pt-pt'] = "";
$text['label-create_recording']['ro-ro'] = "";
$text['label-create_recording']['ru-ru'] = "";
$text['label-create_recording']['sv-se'] = "";
$text['label-create_recording']['uk-ua'] = "";
$text['label-create_recording']['tr-tr'] = "";
$text['label-create_recording']['zh-cn'] = "";
$text['label-create_recording']['ja-jp'] = "";
$text['label-create_recording']['ko-kr'] = "";
$text['description-create_recording']['en-us'] = "When enabled a recording will be created to replace the previous one.";
$text['description-create_recording']['en-gb'] = "When enabled a recording will be created to replace the previous one.";
$text['description-create_recording']['ar-eg'] = "";
$text['description-create_recording']['de-at'] = "";
$text['description-create_recording']['de-ch'] = "";
$text['description-create_recording']['de-de'] = "";
$text['description-create_recording']['el-gr'] = "";
$text['description-create_recording']['es-cl'] = "";
$text['description-create_recording']['es-mx'] = "";
$text['description-create_recording']['fr-ca'] = "";
$text['description-create_recording']['fr-fr'] = "";
$text['description-create_recording']['he-il'] = "";
$text['description-create_recording']['it-it'] = "";
$text['description-create_recording']['nl-nl'] = "";
$text['description-create_recording']['pl-pl'] = "";
$text['description-create_recording']['pt-br'] = "";
$text['description-create_recording']['pt-pt'] = "";
$text['description-create_recording']['ro-ro'] = "";
$text['description-create_recording']['ru-ru'] = "";
$text['description-create_recording']['sv-se'] = "";
$text['description-create_recording']['uk-ua'] = "";
$text['description-create_recording']['tr-tr'] = "";
$text['description-create_recording']['zh-cn'] = "";
$text['description-create_recording']['ja-jp'] = "";
$text['description-create_recording']['ko-kr'] = "";
$text['description-recording']['en-us'] = "A name for the recording.";
$text['description-recording']['en-gb'] = "A name for the recording.";
$text['description-recording']['ar-eg'] = "اسم للتسجيل (لم يتم تحليله).";
$text['description-recording']['de-at'] = "Ein Name für die Aufnahme.";
$text['description-recording']['de-ch'] = "Ein Name für die Aufnahme.";
$text['description-recording']['de-de'] = "Ein Name für die Aufnahme.";
$text['description-recording']['el-gr'] = "Ένα όνομα για την εγγραφή (δεν αναλύεται).";
$text['description-recording']['el-gr'] = "Ένα όνομα για την εγγραφή.";
$text['description-recording']['es-cl'] = "Nombre de la grabación.";
$text['description-recording']['es-mx'] = "Nombre de la grabación.";
$text['description-recording']['fr-ca'] = "Nom de l'enregistrement (non analysé).";
$text['description-recording']['fr-fr'] = "Nom de l'enregistrement (non analysé).";
$text['description-recording']['fr-ca'] = "Nom de l'enregistrement.";
$text['description-recording']['fr-fr'] = "Nom de l'enregistrement.";
$text['description-recording']['he-il'] = "שם להקלטה לא מנותח.";
$text['description-recording']['it-it'] = "Un nome per la registrazione (non parsato).";
$text['description-recording']['nl-nl'] = "Een naam voor de opname (niet gecontroleerd).";
$text['description-recording']['it-it'] = "Un nome per la registrazione.";
$text['description-recording']['nl-nl'] = "Een naam voor de opname.";
$text['description-recording']['pl-pl'] = "Nazwa nagrania.";
$text['description-recording']['pt-br'] = "Nome da gravação:";
$text['description-recording']['pt-pt'] = "Nome da gravação.";
$text['description-recording']['ro-ro'] = "Un nume pentru înregistrare (neparsat).";
$text['description-recording']['ru-ru'] = "Имя для записи (не анализируется).";
$text['description-recording']['ro-ro'] = "Un nume pentru înregistrare.";
$text['description-recording']['ru-ru'] = "Имя для записи.";
$text['description-recording']['sv-se'] = "Namn på Inspelning.";
$text['description-recording']['uk-ua'] = "Ім'я для запису (не розбирається).";
$text['description-recording']['tr-tr'] = "Kayıt için bir ad (ayrıştırılmamış).";
$text['description-recording']['zh-cn'] = "记录的名称(未解析)。";
$text['description-recording']['ja-jp'] = "録音の名前 (解析されません)。";
$text['description-recording']['ko-kr'] = "녹음의 이름(구문 분석되지 않음).";
$text['description-recording']['uk-ua'] = "Ім'я для запису.";
$text['description-recording']['tr-tr'] = "Kayıt için bir ad.";
$text['description-recording']['zh-cn'] = "记录的名称";
$text['description-recording']['ja-jp'] = "録音の名前";
$text['description-recording']['ko-kr'] = "녹음의 이름.";
$text['description-file']['en-us'] = "Name of the file. example.wav";
$text['description-file']['en-gb'] = "Name of the file. example.wav";
@ -754,4 +806,4 @@ $text['description-with_password']['zh-cn'] = "拨打 *732 并输入密码 ||REC
$text['description-with_password']['ja-jp'] = "*732 にダイヤルし、パスワード ||RECORDING_PASSWORD|| を入力し、その後に作成する録音の番号を入力します。 または、最良の結果を得るには、16 ビット 8khz/16khz モノラル WAV ファイルをアップロードします。";
$text['description-with_password']['ko-kr'] = "*732를 다이얼하고 비밀번호 ||RECORDING_PASSWORD||를 입력한 다음 생성할 녹음 번호를 입력합니다. 또는 최상의 결과를 얻으려면 16비트 8khz/16khz 모노 WAV 파일을 업로드하십시오.";
?>
?>

View File

@ -50,7 +50,6 @@
$translate_enabled = false;
$language_enabled = false;
//add the settings object
$settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]);
$speech_enabled = $settings->get('speech', 'enabled', 'false');
@ -80,6 +79,10 @@
//get recording id
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
$recording_uuid = $_REQUEST["id"];
$action = 'update';
}
else {
$action = 'add';
}
//get the form value and set to php variables
@ -87,10 +90,10 @@
$recording_filename = $_POST["recording_filename"] ?? '';
$recording_filename_original = $_POST["recording_filename_original"] ?? '';
$recording_name = $_POST["recording_name"];
$recording_voice = $_POST["recording_voice"];
$recording_model = $_POST["recording_model"];
//$recording_language = $_POST["recording_language"];
//$translate = $_POST["translate"];
$recording_voice = $_POST["recording_voice"];
$recording_message = $_POST["recording_message"];
$recording_description = $_POST["recording_description"];
//sanitize recording filename and name
@ -191,8 +194,19 @@
$recording_filename = str_replace("'", '', $recording_filename);
}
//text to audio - make a new audio file from the message
//determine whether to create the recording
$create_recording = false;
if ($speech_enabled == 'true' && !empty($recording_voice) && !empty($recording_message)) {
if ($action == 'add') {
$create_recording = true;
}
if ($action == 'update' && $_POST["create_recording"] == 'true') {
$create_recording = true;
}
}
//text to audio - make a new audio file from the message
if ($create_recording) {
$speech->audio_path = $recording_path;
$speech->audio_filename = $recording_filename;
$speech->audio_format = $recording_format;
@ -227,6 +241,7 @@
$array['recordings'][0]['recording_filename'] = $recording_filename;
$array['recordings'][0]['recording_name'] = $recording_name;
if ($speech_enabled == 'true' || $transcribe_enabled == 'true') {
$array['recordings'][0]['recording_voice'] = $recording_voice;
$array['recordings'][0]['recording_message'] = $recording_message;
}
$array['recordings'][0]['recording_description'] = $recording_description;
@ -251,7 +266,8 @@
//pre-populate the form
if (!empty($_GET) && empty($_POST["persistformvar"])) {
$recording_uuid = $_GET["id"];
$sql = "select recording_name, recording_filename, recording_message, recording_description ";
$sql = "select recording_name, recording_filename, ";
$sql .= "recording_voice, recording_message, recording_description ";
$sql .= "from v_recordings ";
$sql .= "where domain_uuid = :domain_uuid ";
$sql .= "and recording_uuid = :recording_uuid ";
@ -262,6 +278,7 @@
if (is_array($row) && @sizeof($row) != 0) {
$recording_filename = $row["recording_filename"];
$recording_name = $row["recording_name"];
$recording_voice = $row["recording_voice"];
$recording_message = $row["recording_message"];
$recording_description = $row["recording_description"];
}
@ -355,7 +372,8 @@
echo " <select class='formfld' name='recording_voice'>\n";
echo " <option value=''></option>\n";
foreach ($voices as $key => $voice) {
echo " <option value='".escape(gettype($key) === "integer" ? $voice : $key)."' ".(!empty($recording_voice) && $voice == $recording_voice ? "selected='selected'" : null).">".escape(ucwords($voice))."</option>\n";
$recording_voice_selected = (!empty($recording_voice) && $key == $recording_voice) ? "selected='selected'" : null;
echo " <option value='".escape($key)."' $recording_voice_selected>".escape(ucwords($voice))."</option>\n";
}
echo " </select>\n";
}
@ -425,6 +443,30 @@
echo $text['description-message']."\n";
echo "</td>\n";
echo "</tr>\n";
if ($action == 'update') {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-create_recording']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
if (substr($_SESSION['theme']['input_toggle_style']['text'], 0, 6) == 'switch') {
echo " <label class='switch'>\n";
echo " <input type='checkbox' id='create_recording' name='create_recording' value='true' ".(!empty($create_recording) && $create_recording == 'true' ? "checked='checked'" : null).">\n";
echo " <span class='slider'></span>\n";
echo " </label>\n";
}
else {
echo " <select class='formfld' id='create_recording' name='create_recording'>\n";
echo " <option value='true' ".($create_recording == 'true' ? "selected='selected'" : null).">".$text['option-true']."</option>\n";
echo " <option value='false' ".($create_recording == 'false' ? "selected='selected'" : null).">".$text['option-false']."</option>\n";
echo " </select>\n";
}
echo "<br />\n";
echo $text['description-create_recording']."\n";
echo "</td>\n";
echo "</tr>\n";
}
}
echo "<tr>\n";