try that
 
SELECT t1.from_uri as Caller,  t1.to_uri as Callee,
TIMEDIFF(t2.time, t1.time) as Duration,  t1.time as CallDate
FROM acc t1, acc t2  WHERE t1.sip_callid = t2.sip_callid AND
((t1.fromtag = t2.fromtag and t1.totag = t2.totag) OR
 (t1.fromtag = t2.totag and t1.totag = t2.fromtag)) AND
 t1.sip_method='ACK' AND
 t2.sip_method='BYE'
order by t1.time desc
-----Message d'origine-----
De : serusers-bounces@iptel.org [mailto:serusers-bounces@lists.iptel.org] De la part de Script Head
Envoyé : samedi 18 février 2006 2:03
À : serusers@lists.iptel.org
Objet : Re: [Serusers] SER billing softwares

Well another newbie question - is it possible to generate CDR either directly or by parsing logs? Has something like this been done? I have Googled this more than once and haven't stumbled on anything like that.