first off, forget modems. You will need a computer with some kind of telco interface, this could be a PRI (t1) card or a Digium TDM400 or TDM2400 (analog lines) cards. You could also go voip and use an internet telephony service provider (ITSP), of which there are many.
Second, i recommend you read the book Asterisk: The Future of Telephony. It is available in dead-tree form from O’Rilley or you can download a PDF for free (creative commons license) at asteriskdocs.org
As for actually doing what you want, there are a few ways of doing it. Probably the easiest is something like this:
exten => s,1,Answer()
exten => s,2,Playback(instructions) ; voice recording of instructions
exten => s,3,Beep()
exten => s,4,Record(${CALLERID}-${DATETIME}.mp3,3,20,skip)
exten => s,5,MySQL(your query)
You get the general idea. What this will do is answer a call, playback a voice file of instructions, beep, then record a file in the form callerid-timestamp.mp3, of 20 seconds max length, stopping after 3 seconds or more of silence, skipping if the call has hung up. It will then do whatever you want to MySQL.
You can also write a custom AGI application that will do all this for you, although AGI consumes more CPU time than doing it in the dialplan as above. All the stuff above is documented on the wiki, voip-info.org.
You’ll want a pretty beefy system for this, especially if you have many voice channels, I’d say 2.4ghz xeon with at least 512mb ram or equivalent. MP3 encoding takes up alot of CPU, you could save CPU on your asterisk box by recording to WAV or GSM files, then encoding to MP3 on another box.
Hopefully this at least points you in the right direction!