[Asterisk-Dev] [PATCH] cdr_mysql.c

Matteo Brancaleoni mbrancaleoni at espia.it
Mon Jun 9 13:46:31 MST 2003


As my last email (sent only to the user list)

there's a new cdr_mysql.c . I've included the whole
file, since the changes are *a lot*.
That's a new version of the previous posted,
as the code has been optimized and cleaned.

I repeat here the changes against cdr_mysql in cvs are:
* now cdr_mysql is in sync with cdr_cvs as of fields logged
* added some sanity checks to the code, to make mysql happy
  (and not to loose inserts...)
* the app check the table fields lengths and automagically adjusts 
  the values used to make mysql happy (defaults to cdr.h values)

TODO:
check if the mysql connection is died.
reconnect if needed.

Mark, consider that fully disclaimed, if you think is ok
to be added into cvs. I've attached the new table structure
(backward compatible with cdr_mysql.old ).

matteo.

-- 

Matteo Brancaleoni
Espia System Administrator
http://www.espia.it

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cdr_mysql.c
Type: application/octet-stream
Size: 13803 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-dev/attachments/20030609/4d0059a5/cdr_mysql.obj
-------------- next part --------------
# phpMyAdmin MySQL-Dump
# version 2.5.0
# http://www.phpmyadmin.net/ (download page)
#
# Host: localhost
# Generato il: 09 Giu, 2003 at 10:43 
# Versione MySQL: 3.23.56
# Versione PHP: 4.2.2
# Database : `asterisk`
# --------------------------------------------------------

#
# Struttura della tabella `cdr`
#
# Creazione: 09 Giu, 2003 at 10:27 
# Ultimo cambiamento: 09 Giu, 2003 at 10:29 
#

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=3 ;



More information about the asterisk-dev mailing list