System information

else null end
) as 'QUALITY (0 = worst,10=best)'
FROM tb_cdrs b WITH(NOLOCK) WHERE
b.datum >= GETDATE()-1
and b.realduration > 0
GROUP BY b.marker ORDER BY b.marker
--cdr list
select top 10 marker,connecttime,realduration,rtpsent,rtprec,rtplost,
case
when realduration > 5 and realduration < 35 and (rtpsent > 400 or rtprec > 400) and
(
(rtpsent >= 0 and rtpsent < rtprec/9) or
(rtprec >= 0 and rtprec < rtpsent/9) or
(rtplost > rtpsent/2)
)
then 'NOVOICE'
when realduration > 5 and realduration < 55 and (rtpsent > 400 or rtprec > 400) and
(
(rtpsent >= 0 and rtpsent < rtprec/2) or
(rtprec >= 0 and rtprec < rtpsent/2) or
(rtplost > rtpsent/4)
)
then 'LOWQUALITY'
when realduration > 40 and rtpsent > 2000 and rtprec > 2000 and
(
(rtpsent > rtprec/2) and
(rtprec > rtpsent/2) and
(rtplost < rtpsent/6)
)
then 'GOODQUALITY'
when realduration > 140
then 'GOODQUALITY'
else 'UNKNOWN' end
from tb_cdrs with(nolock)
where datum > getdate()-1
and realduration > 3
order by datum desc