Voicemail and name next to number

hi. in extensions.conf i do have

exten => 123456,1,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => 123456,n,Answer()
exten => 123456,n,Wait(1)

with that when a call for 123456 is made it will lookup internal asterisk’s database and see if the number has a name next to it and if yes it will appear in softphone and IP phones name and number.

in voicemail.conf i have it configured to send me email with the voice file attached and the following text:

emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX} at ${CallTime}
 The following definition is very close to the default, but the default shows
 just the CIDNAME, if it is not null, otherwise just the CIDNUM, or "an unknown
 caller", if they are both null.
emailbody=Dear ${VM_NAME}:\n\n\tjust wanted to let you know you were just left a ${VM_DUR} long message (number ${VM_MSGNUM})\nin mailbox ${VM_MAILBOX} from ${VM_CALLERID}, on ${VM_DATE}, so you might\nwant to check it when you get a chance.  Thanks!\n\n\t\t\t\t--Asterisk\n

;

Is there any way to have it lookup the asterisk’s database to have the name as well the number in the voicemail, please?

If you run database show it will show all the db contents. But voicemail variables are not stored on the Asterisk DB , instead you could use ${VM_NAME} * - Full name in voicemail (channel variabale). but this variable is only avaiable when the voicemail application is executed. Or you could save the name on an external DB let say MYSQL