[Users] SQL query to generate CDR out of ACC logs

Mike Williams mwilliams at etc1.net
Fri May 26 19:18:00 CEST 2006


This is one I've been using, it gets me what I need.

SELECT 
			invite.from_uri, 
			invite.to_uri,
			invite.sip_callid,
			invite.timestamp as start,
			bye.timestamp as end,
			TIMESTAMPDIFF(MINUTE, invite.timestamp, bye.timestamp) as time,
			subscriber.id,
			user_info.first_name,
			user_info.last_name
		FROM acc as invite, acc as bye, subscriber, subscriber as user_info
		WHERE
			invite.sip_method="INVITE" AND 
			bye.sip_method="BYE" AND
			invite.sip_callid = bye.sip_callid AND
			(subscriber.username = bye.username OR subscriber.username = 
invite.username) AND
			user_info.username = invite.username AND
			user_info.domain = invite.domain


On Friday 26 May 2006 12:52, Script Head wrote:
> Does anyone have a query that'd generate some sort of a CDR out of ACC log
> table? Supposely it's been posted before but I've looked thru the archives
> and didn't find it.




More information about the Users mailing list