[Asterisk-Users] New cdr_mysql.c

Brancaleoni Matteo mbrancaleoni at espia.it
Sat Jun 7 06:30:53 MST 2003


Hi.
here is a brand new cdr_mysql .

Is based on the previous one, but with lots of changes, so I include
here the whole file, not a patch.
What I've changed:
added new fields, in order to reflect cdr csv  :
* call start time
* call answer time
* call end time
* call unique id

Changed the table structure to reflect cdr.h lengths.

Added some (a lot?) sanity checks, to be sure to insert
records that fits into mysql, and not to exit with "Failed insert" 
errors. Also now on load/reload cdr mysql checks the table structure
to adjust the fields length values (and issue warnings if some
fields are too small).

Feel free to blame me (I'm not a C guru). I can fix any error, of
course. Mark feel free to add it to asterisk, if u think that's
a good work. I'll disclaim, if needed.

Positive and/or negative comments are welcome.

Matteo.

-- 
Matteo Brancaleoni
Powered by RedHat Linux 8.0
Linux User #153521
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GS d? s:- a- C+++ UL++++ P+ L+++ E- W+++ N++ o K- w--
O- M-- V-- PS PE- Y PGP++ t 5 X+ R tv- b++ DI D+
G e h! r++ y
------END GEEK CODE BLOCK------
-------------- next part --------------
# phpMyAdmin MySQL-Dump
# version 2.5.0
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Generato il: 07 Giu, 2003 at 03:23 
# Versione MySQL: 3.23.56
# Versione PHP: 4.2.2
# Database : `asterisk`
# --------------------------------------------------------

#
# Struttura della tabella `cdr`
#
# Creazione: 07 Giu, 2003 at 02:57 
# Ultimo cambiamento: 07 Giu, 2003 at 03:07 
#

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 '',
  `start` datetime NOT NULL default '0000-00-00 00:00:00',
  `answer` datetime NOT NULL default '0000-00-00 00:00:00',
  `end` datetime NOT NULL default '0000-00-00 00:00:00',
  `duration` int(11) NOT NULL default '0',
  `billsec` int(11) NOT NULL default '0',
  `disposition` int(11) NOT NULL default '0',
  `amaflags` int(11) NOT NULL default '0',
  `accountcode` varchar(20) NOT NULL default '',
  `uniqueid` varchar(32) NOT NULL default '',
  PRIMARY KEY  (`ID`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdr_mysql.c
Type: text/x-c
Size: 32160 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20030607/81712c9d/cdr_mysql.bin


More information about the asterisk-users mailing list