Add Default Settings for Grandstream Templates, and custom transcription provider for Email Queues (#6401)

This commit is contained in:
Dan
2022-05-31 22:05:23 -07:00
committed by GitHub
parent 795254a421
commit 4dd80fb779
2 changed files with 57 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ if (!function_exists('transcribe')) {
$transcribe_provider = $_SESSION['voicemail']['transcribe_provider']['text'];
$transcribe_language = $_SESSION['voicemail']['transcribe_language']['text'];
//transribe - watson
//transcribe - watson
if ($transcribe_provider == 'watson') {
$api_key = $_SESSION['voicemail']['watson_key']['text'];
$api_url = $_SESSION['voicemail']['watson_url']['text'];
@@ -115,7 +115,7 @@ if (!function_exists('transcribe')) {
}
}
//transribe - google
//transcribe - google
if ($transcribe_provider == 'google') {
$api_key = $_SESSION['voicemail']['google_key']['text'];
$api_url = $_SESSION['voicemail']['google_url']['text'];
@@ -178,7 +178,7 @@ if (!function_exists('transcribe')) {
}
}
//transribe - azure
//transcribe - azure
if ($transcribe_provider == 'azure') {
$api_key = $_SESSION['voicemail']['azure_key']['text'];
$api_url = $_SESSION['voicemail']['azure_server_region']['text'];
@@ -223,6 +223,43 @@ if (!function_exists('transcribe')) {
}
//transcribe - custom
//Works with Mozilla DeepSpeech or Coqui with https://github.com/AccelerateNetworks/DeepSpeech_Frontend
//or Vosk with https://git.callpipe.com/fusionpbx/vosk_frontend
if ($transcribe_provider == 'custom') {
$api_key = $_SESSION['voicemail']['api_key']['text'];
$api_url = $_SESSION['voicemail']['transcription_server']['text'];
if (strlen($transcribe_language) == 0) {
$transcribe_language = 'en-US';
}
if ($file_extension == "mp3") {
$content_type = 'audio/mp3';
}
if ($file_extension == "wav") {
$content_type = 'audio/wav';
}
$file_path = $file_path.'/'.$file_name;
$command = "curl -X POST ".$api_url." -H 'Authorization: Bearer ".$api_key."' -F file=@".$file_path;
echo $command."\n";
$http_response = shell_exec($command);
$array = json_decode($http_response, true);
if ($array === null) {
return false;
}
else {
$message = $array['message'];
}
$array['provider'] = $transcribe_provider;
$array['language'] = $transcribe_language;
$array['api_key'] = $api_key;
$array['command'] = $command;
$array['message'] = $message;
return $array;
}
}
}

View File

@@ -802,9 +802,25 @@
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_long_label";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "0";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "1";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Use Long Label. 0 - No, 1 - Yes. Default is 0";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "39fc74a8-1af6-4150-ba2b-52a2597f324c";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_configuration_via_keypad";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "0";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Configuration Via Keypad Menu. 0 - Unrestricted, 1 - Basic settings only, 2 - Constraint mode, 3 - Locked Mode. Default is 0";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "06e28a20-25ed-484f-b385-a64361c9aed1";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "provision";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "grandstream_dhcp_time_zone";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "0";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Allow DHCP server to set Time Zone. 0 - No, 1 - Yes";
$y++;
?>