From e5025d394fcf745aca8e01a925e7bd46ae2d68e5 Mon Sep 17 00:00:00 2001 From: emak-Corey Date: Thu, 26 Oct 2023 15:53:38 -0400 Subject: [PATCH] Fix vm_disk_quota (#6814) The current condition #vm_disk_quota <= #message_sum is checking the lengths of vm_disk_quota and message_sum, not their actual values. So, it won't compare the numeric values for your intended logic. If they're strings that can be safely converted to numbers, use tonumber(): if (vm_disk_quota and message_sum and tonumber(vm_disk_quota) <= tonumber(message_sum)) then -- your code end This will compare them as numbers, ensuring that vm_disk_quota is less than or equal to message_sum. --- app/switch/resources/scripts/app/voicemail/index.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/switch/resources/scripts/app/voicemail/index.lua b/app/switch/resources/scripts/app/voicemail/index.lua index e78eb754f6..6c43c5d014 100644 --- a/app/switch/resources/scripts/app/voicemail/index.lua +++ b/app/switch/resources/scripts/app/voicemail/index.lua @@ -472,7 +472,7 @@ dbh:query(sql, params, function(row) message_sum = row["message_sum"]; end); - if (vm_disk_quota and message_sum and #vm_disk_quota <= #message_sum) then + if (vm_disk_quota and message_sum and tonumber(vm_disk_quota) <= tonumber(message_sum)) then --play message mailbox full session:execute("playback", sounds_dir.."/"..default_language.."/"..default_dialect.."/"..default_voice.."/voicemail/vm-mailbox_full.wav") --hangup