Asterisk DB field value definitions

Hi,
I was asked to extract some reports from Asterisk DB (DB type MySQL)
All I need is:

[ul]1. Total call time (in minutes or seconds) for each operator
2. Number of missed calls
3. Number of total calls for each operator and all operators
4. Number of calls to Call Center (calls which reached operators)
5. Number of answered calls for each operator and all operators[/ul]

My cdr table structure is standart and as follows:


CREATE TABLE `cdr` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `calldate` datetime NOT NULL default '0000-00-00 00:00:00',
  `clid` varchar(80) NOT NULL default '',
  `src` varchar(80) NOT NULL default '',
  `dst` varchar(80) NOT NULL default '',
  `dcontext` varchar(80) NOT NULL default '',
  `channel` varchar(80) NOT NULL default '',
  `dstchannel` varchar(80) NOT NULL default '',
  `lastapp` varchar(80) NOT NULL default '',
  `lastdata` varchar(80) NOT NULL default '',
  `duration` int(11) NOT NULL default '0',
  `billsec` int(11) NOT NULL default '0',
  `disposition` varchar(45) NOT NULL default '',
  `amaflags` int(11) NOT NULL default '0',
  `accountcode` varchar(20) NOT NULL default '',
  `userfield` varchar(255) NOT NULL default '',
  `uniqueid` varchar(32) NOT NULL default '',
  PRIMARY KEY  (`id`),
  KEY `calldate` (`calldate`),
  KEY `dst` (`dst`),
  KEY `accountcode` (`accountcode`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=194855 ;

Could you tell me please how can I extract aforementioned data from this table. I mean, how do I have to filter (by what kind of criteria) and which fields of this table do I have to filter.

:blush:

Hi there,

For “2. Number of missed calls” you need to put this in cdr.conf:

unanswered = yes

By default there’s CDR only for answered calls. Later if I have some free time I’ll post some SQL examples.

The queue log seems more suited to this than CDRs.