Add voicemail params to the directory section of the xml handler

This commit is contained in:
Mark Crane
2014-10-03 06:17:43 +00:00
parent c67fb2c877
commit 0665e83aa4

View File

@@ -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, [[ <params>]]);
table.insert(xml, [[ <param name="password" value="]] .. password .. [["/>]]);
--table.insert(xml, [[ <param name="vm-enabled" value="]] .. vm_enabled .. [["/>]]);
--if (string.len(vm_mailto) > 0) then
-- table.insert(xml, [[ <param name="vm-password" value="]] .. vm_password .. [["/>]]);
-- table.insert(xml, [[ <param name="vm-email-all-messages" value="]] .. vm_enabled ..[["/>]]);
-- table.insert(xml, [[ <param name="vm-attach-file" value="]] .. vm_attach_file .. [["/>]]);
-- table.insert(xml, [[ <param name="vm-keep-local-after-email" value="]] .. vm_keep_local_after_email .. [["/>]]);
-- table.insert(xml, [[ <param name="vm-mailto" value="]] .. vm_mailto .. [["/>]]);
--end
table.insert(xml, [[ <param name="vm-enabled" value="]] .. vm_enabled .. [["/>]]);
if (string.len(vm_mailto) > 0) then
table.insert(xml, [[ <param name="vm-password" value="]] .. vm_password .. [["/>]]);
table.insert(xml, [[ <param name="vm-email-all-messages" value="]] .. vm_enabled ..[["/>]]);
table.insert(xml, [[ <param name="vm-attach-file" value="]] .. vm_attach_file .. [["/>]]);
table.insert(xml, [[ <param name="vm-keep-local-after-email" value="]] .. vm_keep_local_after_email .. [["/>]]);
table.insert(xml, [[ <param name="vm-mailto" value="]] .. vm_mailto .. [["/>]]);
end
if (string.len(mwi_account) > 0) then
table.insert(xml, [[ <param name="MWI-Account" value="]] .. mwi_account .. [["/>]]);
end