MySQL Query : Calls Answered For < 5 Sec

Home » Asterisk Users » MySQL Query : Calls Answered For < 5 Sec
Asterisk Users 9 Comments

Hello,

I am trying to construct MySQL query(s) to get a list of calls which lasted for less than 5 seconds between a given date range. Any help is appreciated.

Thank you in advance.

Regards, Sans

9 thoughts on - MySQL Query : Calls Answered For < 5 Sec

  • Select * from cdr where duration < 5 and (calldate=> date1 and calldate < = date2) From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of RSCL Mumbai Sent: Friday, September 14, 2012 11:16 AM
    To: Asterisk Users Mailing List – Non-Commercial Discussion Subject: [asterisk-users] MySQL Query : Calls Answered for < 5 sec Hello, I am trying to construct MySQL query(s) to get a list of calls which lasted for less than 5 seconds between a given date range. Any help is appreciated. Thank you in advance. Regards, Sans

  • On the CDR database, to get all calls that lasted < 5 seconds between 2012-09-01 and 2012-09-07 (inclusive), the MySQL query would be: select * from cdr where calldate >= ‘2012-09-01’ and calldate < '2012-09-08' and duration < 5; Regards, — Raj

  • @Raj

    I tried your query and variation by using replacing duration with billsec. In both cases, I get results including disposition “NO ANSWER”

  • Change to this:

    select * from cdr where calldate >= ‘2012-09-01’ and calldate < '2012-09-08' and duration < 5 and disposition<>’NO ANSWER’;

    From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On the CDR database, to get all calls that lasted < 5 seconds between 2012-09-01 and 2012-09-07 (inclusive), the MySQL query would be: select * from cdr where calldate >= ‘2012-09-01’ and calldate < '2012-09-08' and duration < 5; Regards, — Raj

  • If you don’t want the “NO ANSWER” disposition, add an AND NOT DISPOSITION ‘NO ANSWER’ to your query. This is all pretty basic SQL Query writing, not specific to asterisk…