[Serusers] ReINVITE logging query

sip sip at arcdiv.com
Thu May 4 20:45:30 CEST 2006


So... currently, we use a query modified from the one provided by the ever
helpful Olivier Taylor to get CDR-like call-log info from SER's acc:

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='INVITE'
AND t2.sip_method='BYE' AND t1.from_uri='<username>' ORDER BY t1.time DESC;


It works really well with one glaring problem.... reINVITES get logged as
separate calls. We see a lot of these going through FWD and our PSTN stuff and
several other providers we peer with, and it becomes weird.  For instance, a
normal call...

userA --> proxy --> userB

Works really well UNLESS there's a reINVITE from userB to userA for a direct
path. In that case, for a 10-second call, we get call logs that looks like: 

Outgoing:  uriA | uriB | 00:10 | 2006-04-04 13:34:48
Incoming:  uriB | uriA | 00:10 | 2006-04-04 13:34:48

The same call is logged twice as it logs both the INVITE outgoing and the
incoming reINVITE. 


Can anyone think of a query that would strip the reINVITEs? Or are we likely
going to have to do something programatically to get rid of these? 

Thanks,

N.




More information about the sr-users mailing list