From ac47cc28283ee044f353e8605341183a10f32223 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sun, 25 May 2014 01:43:47 +0000 Subject: [PATCH] Add ability to configure the extension directory xml to provide the option to use freeswitch voicemail --- app/extensions/app_languages.php | 80 ++++++------- app/extensions/extension_copy.php | 23 ++-- app/extensions/extension_edit.php | 105 +++++++++--------- app/extensions/extensions.php | 4 +- .../resources/classes/extension.php | 58 +++++----- 5 files changed, 135 insertions(+), 135 deletions(-) diff --git a/app/extensions/app_languages.php b/app/extensions/app_languages.php index a08b80632c..6d96c1d632 100644 --- a/app/extensions/app_languages.php +++ b/app/extensions/app_languages.php @@ -90,15 +90,15 @@ $text['description-user_list']['pt-pt'] = "Atribuir os utilizadores que estão associados a esta extensão."; $text['description-user_list']['fr-fr'] = "Assigner cette extension aux utilisateur."; - $text['label-vm_password']['en-us'] = "Voicemail Password"; - $text['label-vm_password']['es-cl'] = "Contraseña de correo de voz"; - $text['label-vm_password']['pt-pt'] = "Password do Correio de Voz"; - $text['label-vm_password']['fr-fr'] = "Mot de passe de la messagerie vocale"; + $text['label-voicemail_password']['en-us'] = "Voicemail Password"; + $text['label-voicemail_password']['es-cl'] = "Contraseña de correo de voz"; + $text['label-voicemail_password']['pt-pt'] = "Password do Correio de Voz"; + $text['label-voicemail_password']['fr-fr'] = "Mot de passe de la messagerie vocale"; - $text['description-vm_password']['en-us'] = "Enter the numeric voicemail password here."; - $text['description-vm_password']['es-cl'] = "Ingrese la contraseña numérica para el correo de voz aquí."; - $text['description-vm_password']['pt-pt'] = "Introduza uma password numérica para o correio de voz aqui."; - $text['description-vm_password']['fr-fr'] = "Insérer un mot de passe numérique pour la messagerie vocale."; + $text['description-voicemail_password']['en-us'] = "Enter the numeric voicemail password here."; + $text['description-voicemail_password']['es-cl'] = "Ingrese la contraseña numérica para el correo de voz aquí."; + $text['description-voicemail_password']['pt-pt'] = "Introduza uma password numérica para o correio de voz aqui."; + $text['description-voicemail_password']['fr-fr'] = "Insérer un mot de passe numérique pour la messagerie vocale."; $text['label-accountcode']['en-us'] = "Account Code"; $text['label-accountcode']['es-cl'] = "Código de Cuenta"; @@ -252,45 +252,45 @@ $text['label-device_template']['pt-pt'] = "Template"; $text['label-device_template']['fr-fr'] = "Template"; - $text['label-vm_enabled']['en-us'] = "Voicemail Enabled"; - $text['label-vm_enabled']['es-cl'] = "Correo de Voz Activado"; - $text['label-vm_enabled']['pt-pt'] = "Correio de Voz Habilitado"; - $text['label-vm_enabled']['fr-fr'] = "Messagerie Vocale Active"; + $text['label-voicemail_enabled']['en-us'] = "Voicemail Enabled"; + $text['label-voicemail_enabled']['es-cl'] = "Correo de Voz Activado"; + $text['label-voicemail_enabled']['pt-pt'] = "Correio de Voz Habilitado"; + $text['label-voicemail_enabled']['fr-fr'] = "Messagerie Vocale Active"; - $text['description-vm_enabled']['en-us'] = "Enable/disable voicemail for this extension."; - $text['description-vm_enabled']['es-cl'] = "Activar/desactivar el correo de voz para esta extensión."; - $text['description-vm_enabled']['pt-pt'] = "Habilitar/Desabilitar o correio de voz para esta extensão."; - $text['description-vm_enabled']['fr-fr'] = "Messagerie Vocale disponible ou non pour cette extension."; + $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."; + $text['description-voicemail_enabled']['pt-pt'] = "Habilitar/Desabilitar o correio de voz para esta extensão."; + $text['description-voicemail_enabled']['fr-fr'] = "Messagerie Vocale disponible ou non pour cette extension."; - $text['label-vm_mailto']['en-us'] = "Voicemail Mail To"; - $text['label-vm_mailto']['es-cl'] = "Enviar correo de voz a"; - $text['label-vm_mailto']['pt-pt'] = "Enviar correio de voz para"; - $text['label-vm_mailto']['fr-fr'] = "Courriel destination"; + $text['label-voicemail_mail_to']['en-us'] = "Voicemail Mail To"; + $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['description-vm_mailto']['en-us'] = "Enter the email address to send voicemail to (optional)."; - $text['description-vm_mailto']['es-cl'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; - $text['description-vm_mailto']['pt-pt'] = "Introduza o endereço de email para enviar o correio de voz (opcional)."; - $text['description-vm_mailto']['fr-fr'] = "Insérer le courriel où sera envoyé le message de notification (optionnel)."; + $text['description-voicemail_mail_to']['en-us'] = "Enter the email address to send voicemail to (optional)."; + $text['description-voicemail_mail_to']['es-cl'] = "Ingrese una dirección de correo electrónico para enviar el correo de voz (opcional)."; + $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['label-vm_attach_file']['en-us'] = "Voicemail Attach File"; - $text['label-vm_attach_file']['es-cl'] = "Adjuntar Archivo de Correo de Voz"; - $text['label-vm_attach_file']['pt-pt'] = "Anexar Ficheiro Áudio"; - $text['label-vm_attach_file']['fr-fr'] = "Fichier Audio"; + $text['label-voicemail_attach_file']['en-us'] = "Voicemail Attach File"; + $text['label-voicemail_attach_file']['es-cl'] = "Adjuntar Archivo de Correo de Voz"; + $text['label-voicemail_attach_file']['pt-pt'] = "Anexar Ficheiro Áudio"; + $text['label-voicemail_attach_file']['fr-fr'] = "Fichier Audio"; - $text['description-vm_attach_file']['en-us'] = "Choose whether to attach the voicemail to the email as an audio file."; - $text['description-vm_attach_file']['es-cl'] = "Seleccione si desea adjuntar el correo de voz al correo electrónico como un archivo de audio."; - $text['description-vm_attach_file']['pt-pt'] = "Escolha se deseja anexar o correio de voz ao email como um ficheiro de áudio."; - $text['description-vm_attach_file']['fr-fr'] = "Choisir si l'enregistrement audio est attaché au courriel."; + $text['description-voicemail_attach_file']['en-us'] = "Choose whether to attach the voicemail to the email as an audio file."; + $text['description-voicemail_attach_file']['es-cl'] = "Seleccione si desea adjuntar el correo de voz al correo electrónico como un archivo de audio."; + $text['description-voicemail_attach_file']['pt-pt'] = "Escolha se deseja anexar o correio de voz ao email como um ficheiro de áudio."; + $text['description-voicemail_attach_file']['fr-fr'] = "Choisir si l'enregistrement audio est attaché au courriel."; - $text['label-vm_keep_local_after_email']['en-us'] = "VM Keep Local After Email"; - $text['label-vm_keep_local_after_email']['es-cl'] = "Mantener Mensaje de Voz despues de enviar por Email"; - $text['label-vm_keep_local_after_email']['pt-pt'] = "Manter mensagem de correio de voz depois de enviado o email"; - $text['label-vm_keep_local_after_email']['fr-fr'] = "Message gardé en local après courriel"; + $text['label-voicemail_local_after_email']['en-us'] = "VM Keep Local After Email"; + $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"; - $text['description-vm_keep_local_after_email']['en-us'] = "Keep local file after sending the email."; - $text['description-vm_keep_local_after_email']['es-cl'] = "Mantener el archivo de forma local despues de enviar por correo electrónico."; - $text['description-vm_keep_local_after_email']['pt-pt'] = "Manter o ficheiro local depois de enviar o email."; - $text['description-vm_keep_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'] = "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['label-toll_allow']['en-us'] = "Toll Allow"; $text['label-toll_allow']['es-cl'] = "Permitir Tarifas Especiales"; diff --git a/app/extensions/extension_copy.php b/app/extensions/extension_copy.php index f7feafcaea..e66e60b980 100644 --- a/app/extensions/extension_copy.php +++ b/app/extensions/extension_copy.php @@ -182,30 +182,29 @@ else { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $vm_mailto = $row["voicemail_mail_to"]; - $vm_attach_file = $row["voicemail_attach_file"]; - $vm_keep_local_after_email = $row["voicemail_local_after_email"]; - $vm_enabled = $row["voicemail_enabled"]; + $voicemail_mailto = $row["voicemail_mail_to"]; + $voicemail_attach_file = $row["voicemail_attach_file"]; + $voicemail_local_after_email = $row["voicemail_local_after_email"]; + $voicemail_enabled = $row["voicemail_enabled"]; } unset ($prep_statement); //set the new voicemail password - if (strlen($vm_password) == 0) { - $vm_password = generate_password(9, 1); + if (strlen($voicemail_password) == 0) { + $voicemail_password = generate_password(9, 1); } //add voicemail via class - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->db = $db; $ext->domain_uuid = $domain_uuid; $ext->extension = $extension_new; $ext->number_alias = $number_alias_new; - $ext->vm_password = $vm_password; - $ext->vm_mailto = $vm_mailto; - $ext->vm_attach_file = $vm_attach_file; - $ext->vm_keep_local_after_email = $vm_keep_local_after_email; - $ext->vm_enabled = $vm_enabled; + $ext->voicemail_password = $voicemail_password; + $ext->voicemail_mail_to = $voicemail_mailto; + $ext->voicemail_attach_file = $voicemail_attach_file; + $ext->voicemail_local_after_email = $voicemail_local_after_email; + $ext->voicemail_enabled = $voicemail_enabled; $ext->description = $description; $ext->voicemail(); unset($ext); diff --git a/app/extensions/extension_edit.php b/app/extensions/extension_edit.php index 3d048fcfe2..4cee381661 100644 --- a/app/extensions/extension_edit.php +++ b/app/extensions/extension_edit.php @@ -68,11 +68,11 @@ else { $limit_destination = check_str($_POST["limit_destination"]); $device_uuid = check_str($_POST["device_uuid"]); $device_line = check_str($_POST["device_line"]); - $vm_password = check_str($_POST["vm_password"]); - $vm_enabled = check_str($_POST["vm_enabled"]); - $vm_mailto = check_str($_POST["vm_mailto"]); - $vm_attach_file = check_str($_POST["vm_attach_file"]); - $vm_keep_local_after_email = check_str($_POST["vm_keep_local_after_email"]); + $voicemail_password = check_str($_POST["voicemail_password"]); + $voicemail_enabled = check_str($_POST["voicemail_enabled"]); + $voicemail_mail_to = check_str($_POST["voicemail_mail_to"]); + $voicemail_attach_file = check_str($_POST["voicemail_attach_file"]); + $voicemail_local_after_email = check_str($_POST["voicemail_local_after_email"]); $user_context = check_str($_POST["user_context"]); $range = check_str($_POST["range"]); $autogen_users = check_str($_POST["autogen_users"]); @@ -243,7 +243,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //if (strlen($domain_uuid) == 0) { $msg .= $text['message-required']."domain_uuid
\n"; } if (strlen($extension) == 0) { $msg .= $text['message-required'].$text['label-extension']."
\n"; } //if (strlen($number_alias) == 0) { $msg .= $text['message-required']."Number Alias
\n"; } - //if (strlen($vm_password) == 0) { $msg .= $text['message-required']."Voicemail Password
\n"; } + //if (strlen($voicemail_password) == 0) { $msg .= $text['message-required']."Voicemail Password
\n"; } //if (strlen($accountcode) == 0) { $msg .= $text['message-required']."Account Code
\n"; } //if (strlen($effective_caller_id_name) == 0) { $msg .= $text['message-required']."Effective Caller ID Name
\n"; } //if (strlen($effective_caller_id_number) == 0) { $msg .= $text['message-required']."Effective Caller ID Number
\n"; } @@ -256,9 +256,9 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //if (strlen($directory_exten_visible) == 0) { $msg .= $text['message-required']."Directory Extension Visible
\n"; } //if (strlen($limit_max) == 0) { $msg .= $text['message-required']."Max Callsr
\n"; } //if (strlen($limit_destination) == 0) { $msg .= $text['message-required']."Transfer Destination Number
\n"; } - //if (strlen($vm_mailto) == 0) { $msg .= $text['message-required']."Voicemail Mail To
\n"; } - //if (strlen($vm_attach_file) == 0) { $msg .= $text['message-required']."Voicemail Attach File
\n"; } - //if (strlen($vm_keep_local_after_email) == 0) { $msg .= $text['message-required']."VM Keep Local After Email
\n"; } + //if (strlen($voicemail_mail_to) == 0) { $msg .= $text['message-required']."Voicemail Mail To
\n"; } + //if (strlen($voicemail_attach_file) == 0) { $msg .= $text['message-required']."Voicemail Attach File
\n"; } + //if (strlen($voicemail_local_after_email) == 0) { $msg .= $text['message-required']."VM Keep Local After Email
\n"; } //if (strlen($user_context) == 0) { $msg .= $text['message-required']."User Context
\n"; } //if (strlen($toll_allow) == 0) { $msg .= $text['message-required']."Toll Allow
\n"; } //if (strlen($call_group) == 0) { $msg .= $text['message-required']."Call Group
\n"; } @@ -440,21 +440,20 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //add or update voicemail if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { //set the voicemail password - if (strlen($vm_password) == 0) { - $vm_password = generate_password(9, 1); + if (strlen($voicemail_password) == 0) { + $voicemail_password = generate_password(9, 1); } //voicemail class - require_once "app/extensions/resources/classes/extension.php"; $ext = new extension; $ext->db = $db; $ext->domain_uuid = $domain_uuid; $ext->extension = $extension; $ext->number_alias = $number_alias; - $ext->vm_password = $vm_password; - $ext->vm_mailto = $vm_mailto; - $ext->vm_attach_file = $vm_attach_file; - $ext->vm_keep_local_after_email = $vm_keep_local_after_email; - $ext->vm_enabled = $vm_enabled; + $ext->voicemail_password = $voicemail_password; + $ext->voicemail_mail_to = $voicemail_mailto; + $ext->voicemail_attach_file = $voicemail_attach_file; + $ext->voicemail_local_after_email = $voicemail_local_after_email; + $ext->voicemail_enabled = $voicemail_enabled; $ext->description = $description; $ext->voicemail(); unset($ext); @@ -471,8 +470,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $password = generate_password(); } //set the voicemail password - if (strlen($vm_password) == 0) { - $vm_password = generate_password(9, 1); + if (strlen($voicemail_password) == 0) { + $voicemail_password = generate_password(9, 1); } //update extensions $sql = "update v_extensions set "; @@ -546,11 +545,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $ext->domain_uuid = $domain_uuid; $ext->extension = $extension; $ext->number_alias = $number_alias; - $ext->vm_password = $vm_password; - $ext->vm_mailto = $vm_mailto; - $ext->vm_attach_file = $vm_attach_file; - $ext->vm_keep_local_after_email = $vm_keep_local_after_email; - $ext->vm_enabled = $vm_enabled; + $ext->voicemail_password = $voicemail_password; + $ext->voicemail_mailto = $voicemail_mailto; + $ext->voicemail_attach_file = $voicemail_attach_file; + $ext->voicemail_local_after_email = $voicemail_local_after_email; + $ext->voicemail_enabled = $voicemail_enabled; $ext->description = $description; $ext->voicemail(); unset($ext); @@ -705,18 +704,18 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { $prep_statement->execute(); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); foreach ($result as &$row) { - $vm_password = $row["voicemail_password"]; + $voicemail_password = $row["voicemail_password"]; //$greeting_id = $row["greeting_id"]; - $vm_mailto = $row["voicemail_mail_to"]; - $vm_mailto = str_replace(" ", "", $vm_mailto); - $vm_attach_file = $row["voicemail_attach_file"]; - $vm_keep_local_after_email = $row["voicemail_local_after_email"]; - $vm_enabled = $row["voicemail_enabled"]; + $voicemail_mail_to = $row["voicemail_mail_to"]; + $voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); + $voicemail_attach_file = $row["voicemail_attach_file"]; + $voicemail_local_after_email = $row["voicemail_local_after_email"]; + $voicemail_enabled = $row["voicemail_enabled"]; } unset ($prep_statement); //clean the variables - $vm_password = str_replace("#", "", $vm_password); - $vm_mailto = str_replace(" ", "", $vm_mailto); + $voicemail_password = str_replace("#", "", $voicemail_password); + $voicemail_mail_to = str_replace(" ", "", $voicemail_mail_to); } //set the defaults @@ -935,12 +934,12 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { echo "\n"; echo "\n"; - echo " ".$text['label-vm_password'].":\n"; + echo " ".$text['label-voicemail_password'].":\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo " ".$text['description-vm_password']."\n"; + echo " ".$text['description-voicemail_password']."\n"; echo "\n"; echo "\n"; } @@ -1369,17 +1368,17 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/voicemails')) { echo "\n"; echo "\n"; - echo " ".$text['label-vm_enabled'].":\n"; + echo " ".$text['label-voicemail_enabled'].":\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($voicemail_enabled == "true") { echo " \n"; } else { echo " \n"; } - if ($vm_enabled == "false") { + if ($voicemail_enabled == "false") { echo " \n"; } else { @@ -1387,34 +1386,34 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } echo " \n"; echo "
\n"; - echo $text['description-vm_enabled']."\n"; + echo $text['description-voicemail_enabled']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " ".$text['label-vm_mailto'].":\n"; + echo " ".$text['label-voicemail_mail_to'].":\n"; echo "\n"; echo "\n"; - echo " \n"; + echo " \n"; echo "
\n"; - echo $text['description-vm_mailto']."\n"; + echo $text['description-voicemail_mail_to']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " ".$text['label-vm_attach_file'].":\n"; + echo " ".$text['label-voicemail_attach_file'].":\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($voicemail_attach_file == "true") { echo " \n"; } else { echo " \n"; } - if ($vm_attach_file == "false") { + if ($voicemail_attach_file == "false") { echo " \n"; } else { @@ -1422,23 +1421,23 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } echo " \n"; echo "
\n"; - echo $text['description-vm_attach_file']."\n"; + echo $text['description-voicemail_attach_file']."\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; - echo " ".$text['label-vm_keep_local_after_email'].":\n"; + echo " ".$text['label-voicemail_local_after_email'].":\n"; echo "\n"; echo "\n"; - echo " \n"; + if ($voicemail_local_after_email == "true") { echo " \n"; } else { echo " \n"; } - if ($vm_keep_local_after_email == "false") { + if ($voicemail_local_after_email == "false") { echo " \n"; } else { @@ -1446,7 +1445,7 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { } echo " \n"; echo "
\n"; - echo $text['description-vm_keep_local_after_email']."\n"; + echo $text['description-voicemail_local_after_email']."\n"; echo "\n"; echo "\n"; } diff --git a/app/extensions/extensions.php b/app/extensions/extensions.php index 3efcfb7b15..81fce0eb94 100644 --- a/app/extensions/extensions.php +++ b/app/extensions/extensions.php @@ -140,7 +140,7 @@ require_once "resources/paging.php"; echo "\n"; echo th_order_by('extension', $text['label-extension'], $order_by, $order); echo th_order_by('call_group', $text['label-call_group'], $order_by, $order); - //echo th_order_by('vm_mailto', $text['label-vm_mailto'], $order_by, $order); + //echo th_order_by('voicemail_mail_to', $text['label-voicemail_mail_to'], $order_by, $order); echo th_order_by('enabled', $text['label-enabled'], $order_by, $order); echo th_order_by('description', $text['label-description'], $order_by, $order); echo "\n"; @@ -155,7 +155,7 @@ require_once "resources/paging.php"; echo "\n"; echo " ".$row['extension']."\n"; echo " ".$row['call_group']." \n"; - //echo " ".$row['vm_mailto']." \n"; + //echo " ".$row['voicemail_mail_to']." \n"; echo " ".$row['enabled']."\n"; echo " ".$row['description']." \n"; echo " "; diff --git a/app/extensions/resources/classes/extension.php b/app/extensions/resources/classes/extension.php index 4092486d3c..923d9fb419 100644 --- a/app/extensions/resources/classes/extension.php +++ b/app/extensions/resources/classes/extension.php @@ -36,7 +36,7 @@ public $number_alias; public $password; public $provisioning_list; - public $vm_password; + public $voicemail_password; public $accountcode; public $effective_caller_id_name; public $effective_caller_id_number; @@ -49,10 +49,10 @@ public $directory_exten_visible; public $limit_max; public $limit_destination; - public $vm_enabled; - public $vm_mailto; - public $vm_attach_file; - public $vm_keep_local_after_email; + public $voicemail_enabled; + public $voicemail_mail_to; + public $voicemail_attach_file; + public $voicemail_local_after_email; public $user_context; public $toll_allow; public $call_timeout; @@ -127,11 +127,11 @@ $sql .= "'".$this->domain_uuid."', "; $sql .= "'".uuid()."', "; $sql .= "'".$this->voicemail_id."', "; - $sql .= "'".$this->vm_password."', "; - $sql .= "'".$this->vm_mailto."', "; - $sql .= "'".$this->vm_attach_file."', "; - $sql .= "'".$this->vm_keep_local_after_email."', "; - $sql .= "'".$this->vm_enabled."', "; + $sql .= "'".$this->voicemail_password."', "; + $sql .= "'".$this->voicemail_mail_to."', "; + $sql .= "'".$this->voicemail_attach_file."', "; + $sql .= "'".$this->voicemail_local_after_email."', "; + $sql .= "'".$this->voicemail_enabled."', "; $sql .= "'".$this->description."' "; $sql .= ")"; $this->db->exec(check_sql($sql)); @@ -140,11 +140,11 @@ else { //update the voicemail box $sql = "update v_voicemails set "; - $sql .= "voicemail_password = '".$this->vm_password."', "; - $sql .= "voicemail_mail_to = '".$this->vm_mailto."', "; - $sql .= "voicemail_attach_file = '".$this->vm_attach_file."', "; - $sql .= "voicemail_local_after_email = '".$this->vm_keep_local_after_email."', "; - $sql .= "voicemail_enabled = '".$this->vm_enabled."', "; + $sql .= "voicemail_password = '".$this->voicemail_password."', "; + $sql .= "voicemail_mail_to = '".$this->voicemail_mail_to."', "; + $sql .= "voicemail_attach_file = '".$this->voicemail_attach_file."', "; + $sql .= "voicemail_local_after_email = '".$this->voicemail_local_after_email."', "; + $sql .= "voicemail_enabled = '".$this->voicemail_enabled."', "; $sql .= "voicemail_description = '".$this->description."' "; $sql .= "where domain_uuid = '".$this->domain_uuid."' "; $sql .= "and voicemail_id = '".$this->voicemail_id."' "; @@ -174,9 +174,10 @@ } //write the xml files - $sql = "select * from v_extensions "; - $sql .= "where domain_uuid = '$domain_uuid' "; - $sql .= "order by call_group asc "; + $sql = "SELECT * FROM v_extensions AS e, v_voicemails AS v "; + $sql .= "WHERE e.domain_uuid = '$domain_uuid' "; + $sql .= "AND e.number_alias = v.voicemail_id "; + $sql .= "ORDER BY e.call_group ASC "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $i = 0; @@ -199,8 +200,8 @@ } $call_timeout = $row['call_timeout']; $user_context = $row['user_context']; - //$vm_password = $row['vm_password']; - //$vm_password = str_replace("#", "", $vm_password); //preserves leading zeros + $voicemail_password = $row['voicemail_password']; + //$voicemail_password = str_replace("#", "", $voicemail_password); //preserves leading zeros //echo "enabled: ".$row['enabled']; if ($row['enabled'] != "false") { @@ -231,9 +232,10 @@ $xml .= " \n"; $xml .= " \n"; $xml .= " \n"; - /* - $xml .= " \n"; - switch ($row['vm_enabled']) { + + //voicemail settings + $xml .= " \n"; + switch ($row['voicemail_enabled']) { case "true": $xml .= " \n"; break; @@ -243,10 +245,10 @@ default: $xml .= " \n"; } - if (strlen($row['vm_mailto']) > 0) { + if (strlen($row['voicemail_mail_to']) > 0) { $xml .= " \n"; - switch ($row['vm_attach_file']) { + switch ($row['voicemail_attach_file']) { case "true": $xml .= " \n"; break; @@ -256,7 +258,7 @@ default: $xml .= " \n"; } - switch ($row['vm_keep_local_after_email']) { + switch ($row['voicemail_local_after_email']) { case "true": $xml .= " \n"; break; @@ -266,9 +268,9 @@ default: $xml .= " \n"; } - $xml .= " \n"; + $xml .= " \n"; } - */ + if (strlen($row['mwi_account']) > 0) { $xml .= " \n"; }