Masks mentioned by Cavagnaro can be used but there are some important limitations or conditions related to these. I would suggest you to read section dedicated to AfterCallWork action in StatServer User’s Guide (page 69).
To your second question - I think there are two ways to get required information (ringing time). You can define new statistic with mask CallRinging or you can use following formula - TimeToAnswer - TimeToDistribute.