Collect DTMF and record message

I would like a caller to dial in to an IVR/voicemail box, enter DTMF digits then record a message. I would like to collect the DTMF digits entered, store them then name the recorded message with the preserved DTMF digits. For example:

Caller dials in. After a prompt, they enter 1234. Then they are prompted to record a message. The recorded message is then named 1234.wav and emailed or stored locally.

Any thoughts on how to accomplish this action with native functions within asterisk?

Just use the Read()-application for gathering the digits. As Read stores the digits to a variable You’ll have all You expect.