diff --git a/includes/install/scripts/voicemail.lua b/includes/install/scripts/voicemail.lua index 57a9e9756e..8bb1e77490 100644 --- a/includes/install/scripts/voicemail.lua +++ b/includes/install/scripts/voicemail.lua @@ -97,6 +97,19 @@ if f~=nil then io.close(f) return true else return false end end +--format seconds to 00:00:00 + function format_seconds(seconds) + local seconds = tonumber(seconds); + if seconds == 0 then + return "00:00:00"; + else + hours = string.format("%02.f", math.floor(seconds/3600)); + minutes = string.format("%02.f", math.floor(seconds/60 - (hours*60))); + seconds = string.format("%02.f", math.floor(seconds - hours*3600 - minutes *60)); + return string.format("%02d:%02d:%02d", hours, minutes, seconds); + end + end + --check the voicemail password function check_password(voicemail_id) --please enter your id followed by pound @@ -526,6 +539,7 @@ --calculate the message length message_length = stop_epoch - start_epoch; + message_length_formatted = format_seconds(message_length); freeswitch.consoleLog("notice", "[voicemail] message length: " .. message_length .. "\n"); --send the email with the voicemail recording attached @@ -533,21 +547,21 @@ message = [[ Message From "]]..caller_id_name..[[" ]]..caller_id_number..[[

- Created: ]]..os.date("%d %b %Y", start_epoch)..[[
- Duration: ]]..message_length..[[
+ Created: ]]..os.date("%A, %d %b %Y %I:%M %p", start_epoch)..[[
+ Duration: ]]..message_length_formatted..[[
Account: ]]..voicemail_id..[[@]]..domain_name..[[
]]; if (voicemail_attach_file == "true") then freeswitch.email("", "", - "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length, + "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length_formatted, message, voicemail_dir.."/"..voicemail_id.."/msg_"..uuid..".wav" ); else freeswitch.email("", "", - "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length, + "To: "..voicemail_mail_to.."\nFrom: "..voicemail_mail_to.."\nSubject: Voicemail from "..caller_id_name.." <"..caller_id_number.."> "..message_length_formatted, message ); end