Can you record incoming calls and save as .gsm?

Say I have a DID and I call it. Is there some way to use Asterisk to pick up the call and record my message and save as a .gsm or some other audio format? If so, can you set a time limit of the recording? e.g. I don’t want to let myself or any other user record anything longer than 30 seconds.

Check out the Asterisk cmd Record.

http://www.voip-info.org/wiki/view/Asterisk+cmd+Record

Answer the line, start recording, put a 30 sec duration in the record command, hangup.