Asterisk voicemail odbcstorage issue - urgent help needed

Hello Folks,

I have managed to make unixodbc storage work for my voicemail messages, and it works great.
I have an agi IVR script and it has an option for the caller to leave a voicemail, the entier functionality is working perfect.
I have a table where my agi logs all the calls and also logs when someone selects to leave a voicemail but once the control is passed to VoiceMail it is not coming back to my AGI.
I need to either pass the enquiryid from my cdr table and store it along with Voicemail in the voicemessages table where my VM is getting stored through odbc storage or i want the msgid coming back to AGI after the person has left a VM which i can store against my enquiryid. Basically i need to link the voicemessaeges table with my enquiry db.

Any help in this direction will be appriciated.

Thanks in advance