Custom VoiceMail to e-mail

Hi all,
I try to find out a way to change the default system behavior that is used to send e-mails. The problem is that I want to add unique callid in the msg.txt files. I looked in “vm_email.inc”, “voicemail.conf”, “vm_general.inc”, “extensions_additional.conf” and “extensions.conf”. Predefined variables I can use are: “VM_NAME,VM_DUR,VM_MSGNUM,VM_MAILBOX,VM_CALLERID,VM_DATE”.
I need of a relation between voicemail and the call. The easiest way is to tell the system to save the voice-mail in format $uniquecallid.wav , but I don’t know how to do this. We are using FreePBX 2.4.0.
Any help will be highly appreciated.

FreePBX 2.4 is beyond ancient. It’s end of life, end of support, end of rememberance.

2.5 was really the beginning of “modern” FreePBX. 2.11 is soon to be released.

What you are asking is actually more of an Asterisk function. You may have to make changes directly in Asterisk voice mail module and rebuild it from the source code.