Voicemail:

- Adjust for single-quotes in caller_id_name on insert query (hopefully addressing Issue 877).
- If Keep Local is false, remove the recording from the file system.
- Fix Forward Destinations so message is fully copied to other extension voicemail boxes, not just emailed.
- Add script to Ext and VM Edit pages to prevent Listen or Download links being sent when Keep Local is false.
- Minor language mods.
This commit is contained in:
Nate Jones
2015-03-15 09:15:04 +00:00
parent 0bfe8cc144
commit 8485694537
6 changed files with 40 additions and 28 deletions

View File

@@ -65,7 +65,7 @@ $text['label-voicemail_mail_to']['es-cl'] = "Enviar correo de voz a";
$text['label-voicemail_mail_to']['pt-pt'] = "Enviar correio de voz para";
$text['label-voicemail_mail_to']['fr-fr'] = "Courriel destination";
$text['label-voicemail_local_after_email']['en-us'] = "VM Keep Local After Email";
$text['label-voicemail_local_after_email']['en-us'] = "Voicemail Keep Local";
$text['label-voicemail_local_after_email']['es-cl'] = "Mantener Mensaje de Voz despues de enviar por Email";
$text['label-voicemail_local_after_email']['pt-pt'] = "Manter mensagem de correio de voz depois de enviado o email";
$text['label-voicemail_local_after_email']['fr-fr'] = "Message gardé en local après courriel";
@@ -380,10 +380,10 @@ $text['description-voicemail_mail_to']['es-cl'] = "Ingrese una dirección de cor
$text['description-voicemail_mail_to']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz (opcional).";
$text['description-voicemail_mail_to']['fr-fr'] = "Insérer le courriel où sera envoyé le message de notification (optionnel).";
$text['description-voicemail_local_after_email']['en-us'] = "Keep local file after sending the email.";
$text['description-voicemail_local_after_email']['es-cl'] = "Mantener el archivo de forma local despues de enviar por correo electrónico.";
$text['description-voicemail_local_after_email']['pt-pt'] = "Manter o ficheiro local depois de enviar o email.";
$text['description-voicemail_local_after_email']['fr-fr'] = "Conserver ou non le message sur la messagerie vocale après l'envoi du courriel.";
$text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification.";
$text['description-voicemail_local_after_email']['es-cl'] = "Escoja si desea mantener el buzón de voz en el sistema después de enviar la notificación por correo electrónico.";
$text['description-voicemail_local_after_email']['pt-pt'] = "Escolha se quer manter o correio de voz no sistema após o envio da notificação de e-mail.";
$text['description-voicemail_local_after_email']['fr-fr'] = "Choisissez si vous voulez garder la messagerie vocale dans le système après l'envoi de la notification par email.";
$text['description-voicemail_enabled']['en-us'] = "Enable/disable voicemail for this extension.";
$text['description-voicemail_enabled']['es-cl'] = "Activar/desactivar el correo de voz para esta extensión.";

View File

@@ -1486,7 +1486,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-voicemail_file']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_file'>\n";
echo " <select class='formfld' name='voicemail_file' id='voicemail_file' onchange=\"if (this.selectedIndex != 2) { document.getElementById('voicemail_local_after_email').selectedIndex = 0; }\">\n";
echo " <option value=''>".$text['option-voicemail_file_listen']."</option>\n";
echo " <option value='link' ".(($voicemail_file == "link") ? "selected='selected'" : null).">".$text['option-voicemail_file_link']."</option>\n";
echo " <option value='attach' ".(($voicemail_file == "attach") ? "selected='selected'" : null).">".$text['option-voicemail_file_attach']."</option>\n";
@@ -1501,7 +1501,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-voicemail_local_after_email']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_local_after_email'>\n";
echo " <select class='formfld' name='voicemail_local_after_email' id='voicemail_local_after_email' onchange=\"if (this.selectedIndex == 1) { document.getElementById('voicemail_file').selectedIndex = 2; }\">\n";
if ($voicemail_local_after_email == "true") {
echo " <option value='true' selected >".$text['label-true']."</option>\n";
}

View File

@@ -96,15 +96,15 @@
$text['label-voicemail_file_attached']['pt-pt'] = "Ligado";
$text['label-voicemail_file_attached']['fr-fr'] = "Attaché";
$text['label-voicemail_local_after_email']['en-us'] = "Local After Email";
$text['label-voicemail_local_after_email']['en-us'] = "Keep Local";
$text['label-voicemail_local_after_email']['es-cl'] = "Conservar después de enviar";
$text['label-voicemail_local_after_email']['pt-pt'] = "Conservar Mensagem de Voz";
$text['label-voicemail_local_after_email']['fr-fr'] = "Conserver le message";
$text['description-voicemail_local_after_email']['en-us'] = "Choose to keep the voicemail file after sending the email.";
$text['description-voicemail_local_after_email']['es-cl'] = "Indique si desea conservar el archivo despues de enviarlo por correo.";
$text['description-voicemail_local_after_email']['pt-pt'] = "Escolha se pretende manter o ficheiro de correio de voz depois de enviar email.";
$text['description-voicemail_local_after_email']['fr-fr'] = "Garder le message vocal dans la boite vocale après l'envoi du courriel.";
$text['description-voicemail_local_after_email']['en-us'] = "Choose whether to keep the voicemail in the system after sending the email notification.";
$text['description-voicemail_local_after_email']['es-cl'] = "Escoja si desea mantener el buzón de voz en el sistema después de enviar la notificación por correo electrónico.";
$text['description-voicemail_local_after_email']['pt-pt'] = "Escolha se quer manter o correio de voz no sistema após o envio da notificação de e-mail.";
$text['description-voicemail_local_after_email']['fr-fr'] = "Choisissez si vous voulez garder la messagerie vocale dans le système après l'envoi de la notification par email.";
$text['label-forward_destinations']['en-us'] = "Forward Destinations";
$text['label-forward_destinations']['es-cl'] = "Destinos Adelante";

View File

@@ -448,7 +448,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-voicemail_file']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_file'>\n";
echo " <select class='formfld' name='voicemail_file' id='voicemail_file' onchange=\"if (this.selectedIndex != 2) { document.getElementById('voicemail_local_after_email').selectedIndex = 0; }\">\n";
echo " <option value=''>".$text['option-voicemail_file_listen']."</option>\n";
echo " <option value='link' ".(($voicemail_file == "link") ? "selected='selected'" : null).">".$text['option-voicemail_file_link']."</option>\n";
echo " <option value='attach' ".(($voicemail_file == "attach") ? "selected='selected'" : null).">".$text['option-voicemail_file_attach']."</option>\n";
@@ -463,7 +463,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo " ".$text['label-voicemail_local_after_email']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='voicemail_local_after_email'>\n";
echo " <select class='formfld' name='voicemail_local_after_email' id='voicemail_local_after_email' onchange=\"if (this.selectedIndex == 1) { document.getElementById('voicemail_file').selectedIndex = 2; }\">\n";
if ($voicemail_local_after_email == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}

View File

@@ -293,8 +293,11 @@
--loop through the voicemail destinations
for key,row in pairs(destinations) do
--get a new uuid
voicemail_message_uuid = api:execute("create_uuid");
--save the message to the voicemail messages
if (tonumber(message_length) > 2) then
caller_id_name = string.gsub(caller_id_name,"'","''");
local sql = {}
table.insert(sql, "INSERT INTO v_voicemail_messages ");
table.insert(sql, "(");
@@ -310,15 +313,15 @@
table.insert(sql, ") ");
table.insert(sql, "VALUES ");
table.insert(sql, "( ");
table.insert(sql, "'".. uuid .."', ");
table.insert(sql, "'".. domain_uuid .."', ");
table.insert(sql, "'".. row.voicemail_uuid_copy .."', ");
table.insert(sql, "'".. start_epoch .."', ");
table.insert(sql, "'".. caller_id_name .."', ");
table.insert(sql, "'".. caller_id_number .."', ");
table.insert(sql, "'".. message_length .."' ");
--table.insert(sql, "'".. message_status .."', ");
--table.insert(sql, "'".. message_priority .."' ");
table.insert(sql, "'"..voicemail_message_uuid.."', ");
table.insert(sql, "'"..domain_uuid.."', ");
table.insert(sql, "'"..row.voicemail_uuid_copy.."', ");
table.insert(sql, "'"..start_epoch.."', ");
table.insert(sql, "'"..caller_id_name.."', ");
table.insert(sql, "'"..caller_id_number.."', ");
table.insert(sql, "'"..message_length.."' ");
--table.insert(sql, "'"..message_status.."', ");
--table.insert(sql, "'"..message_priority.."' ");
table.insert(sql, ") ");
sql = table.concat(sql, "\n");
if (debug["sql"]) then
@@ -364,7 +367,7 @@
--copy the voicemail to each destination
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then
os.execute("cp "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.." "..voicemail_dir.."/"..voicemail_id_copy.."/msg_"..uuid.."."..vm_message_ext);
os.execute("cp "..voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext.." "..voicemail_dir.."/"..voicemail_id_copy.."/msg_"..voicemail_message_uuid.."."..vm_message_ext);
end
--set the message waiting event
@@ -378,9 +381,14 @@
--send the email with the voicemail recording attached
if (tonumber(message_length) > 2) then
send_email(voicemail_id_copy, uuid);
send_email(voicemail_id_copy, voicemail_message_uuid);
end
end
--remove initial recording file
if (file_exists(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext)) then
os.remove(voicemail_dir.."/"..voicemail_id.."/msg_"..uuid.."."..vm_message_ext);
end
else
--voicemail not enabled or does not exist

View File

@@ -133,13 +133,13 @@
body = trim(body);
--send the email
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
if (voicemail_file == "attach") then
if (voicemail_local_after_email == "false") then
delete = "true";
else
delete = "false";
end
file = voicemail_dir.."/"..id.."/msg_"..uuid.."."..vm_message_ext;
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."' '"..file.."' "..delete;
else
cmd = "luarun email.lua "..voicemail_mail_to.." "..voicemail_mail_to.." "..headers.." '"..subject.."' '"..body.."'";
@@ -152,8 +152,8 @@
end
--whether to keep the voicemail message and details local after email
if (voicemail_mail_to) then
if (voicemail_local_after_email == "false" and string.len(voicemail_mail_to) > 0) then
if (string.len(voicemail_mail_to) > 2) then
if (voicemail_local_after_email == "false") then
--delete the voicemail message details
sql = [[DELETE FROM v_voicemail_messages
WHERE domain_uuid = ']] .. domain_uuid ..[['
@@ -163,6 +163,10 @@
freeswitch.consoleLog("notice", "[voicemail] SQL: " .. sql .. "\n");
end
status = dbh:query(sql);
--delete voicemail recording file
if (file_exists(file)) then
os.remove(file);
end
--set message waiting indicator
message_waiting(id, domain_uuid);
--clear the variable