[Serusers] accounting question

Nhadie nhadie at cbcpworld.com
Mon Aug 22 17:20:01 CEST 2005


Hi All,

Is my query correct

SELECT t1.from_uri as orig_number,  t1.to_uri as term_number,
TIMEDIFF(t2.time, t1.time) as duration,  t1.timestamp 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='INVITE' AND
t2.sip_method='BYE'

also this query displays all calls fron all user and it shows also all the
previos month, what can I add here to show only calls from a certain user
e.g 2009 and the current month?

I tried this:

SELECT t1.from_uri as orig_number,  t1.to_uri as term_number,
TIMEDIFF(t2.time, t1.time) as duration,  t1.timestamp 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='INVITE' AND t2.sip_method='BYE'
AND t1.username="2009" and t1.time REGEXP '-08-';   <--- I added this line

but i had an error, hope someone can help me. thank you.

regards,
nhadie




More information about the sr-users mailing list