Ring-delayed pick-up on FXO?

I would like to configure Asterisk to act as an answering machine for a PSTN line running alongside other plain phones. Is it possible to configure Asterisk, Zaptel, or Zapata to answer after a certain number of rings? Is it also possible to configure the system so that Asterisk will ring a SIP client(s) in addition to allowing the POTS phones to ring, and to answer the line only if a SIP client answers OR if a certain number of rings have gone unanswered? This would seem like a basic functionality but people on the Internet seem to say they are hoping for it to be in “future releases”. If that is the case, is it possible to modify the source of some part of Zaptel or Asterisk, or create a module, to include this kind of functionality? (I would specify the number of rings in a config file.)

uhhh, this is easy to do

exten => s,1,Dial(SIP/yourphone,20,r) ; dials SIP/yourphone for 20sec, about 4 rings. Does not answer the channel yet unless you pick up
exten => s,2,Answer() ; if nobody picks up in 20sec, answer and…
exten => s,3,VoiceMail(yourvmbox@default) ; goes to mailbox.

The result is that if nobody answers either outside the * box or on sip/yourphone in 20sec after the ring starts, it answers and goes to voicemail. If you want you can replace voicemail() on priority 3 with your IVR or whatever…

I have my asterisk server configured like IronHelix describes and it works great. I have a PSTN line connected to a TDM400 FXO module. Since I do not have caller id on the PSTN line, my SIP phones ring just about the same time as the phone connected in parallel with asterisk on the PSTN line. If you have caller id then you have a ring cycle delay before the SIP phone start ringing because the TDM400 has to wait one ring to get the caller-id, and alerts asterisk of the incoming call.