diff --git a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua index d9692ec03b..82582e5d14 100644 --- a/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua +++ b/resources/install/scripts/app/xml_handler/resources/scripts/directory/directory.lua @@ -200,24 +200,6 @@ end --params password = row.password; - --vm_enabled = "true"; - --if (string.len(row.vm_enabled) > 0) then - -- vm_enabled = row.vm_enabled; - --end - --vm_password = row.vm_password; - --vm_attach_file = "true"; - --if (string.len(row.vm_attach_file) > 0) then - -- vm_attach_file = row.vm_attach_file; - --end - --vm_keep_local_after_email = "true"; - --if (string.len(row.vm_keep_local_after_email) > 0) then - -- vm_keep_local_after_email = row.vm_keep_local_after_email; - --end - --if (string.len(row.vm_mailto) > 0) then - -- vm_mailto = row.vm_mailto; - --else - -- vm_mailto = ""; - --end mwi_account = row.mwi_account; auth_acl = row.auth_acl; --variables @@ -275,6 +257,34 @@ end); end + --get the voicemail from the database + if (continue) then + sql = "SELECT * FROM v_voicemails WHERE domain_uuid = '" .. domain_uuid .. "' and voicemail_id = '" .. user .. "' "; + if (debug["sql"]) then + freeswitch.consoleLog("notice", "[xml_handler] SQL: " .. sql .. "\n"); + end + dbh:query(sql, function(row) + vm_enabled = "true"; + if (string.len(row.voicemail_enabled) > 0) then + vm_enabled = row.voicemail_enabled; + end + vm_password = row.voicemail_password; + vm_attach_file = "true"; + if (string.len(row.voicemail_attach_file) > 0) then + vm_attach_file = row.voicemail_attach_file; + end + vm_keep_local_after_email = "true"; + if (string.len(row.voicemail_local_after_email) > 0) then + vm_keep_local_after_email = row.voicemail_local_after_email; + end + if (string.len(row.voicemail_mail_to) > 0) then + vm_mailto = row.voicemail_mail_to; + else + vm_mailto = ""; + end + end); + end + --if the extension does not exist set continue to false; if (extension_uuid == nil) then continue = false; @@ -342,14 +352,14 @@ end table.insert(xml, [[ ]]); table.insert(xml, [[ ]]); - --table.insert(xml, [[ ]]); - --if (string.len(vm_mailto) > 0) then - -- table.insert(xml, [[ ]]); - -- table.insert(xml, [[ ]]); - -- table.insert(xml, [[ ]]); - -- table.insert(xml, [[ ]]); - -- table.insert(xml, [[ ]]); - --end + table.insert(xml, [[ ]]); + if (string.len(vm_mailto) > 0) then + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + table.insert(xml, [[ ]]); + end if (string.len(mwi_account) > 0) then table.insert(xml, [[ ]]); end