[Home]

Summary:ASTERISK-15818: [patch] Perl script to import CDR text file to ODBC database table
Reporter:precisenetworks (precisenetworks)Labels:
Date Opened:2010-03-15 22:23:04Date Closed:2011-05-06 15:47:40
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Utilities/NewFeature
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) import-cdr-csv-mysql.pl
Description:I hope to save others from reinventing the wheel.  The code could be optimized a little, but it works on the default cdr format quite well.  The prerequisite table will need to be configured.  Here is the statement I used to create my cdr table in MySQL:

CREATE TABLE `cdr` (
 `id` int(11) unsigned primary key 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 '',
 `uniqueid` VARCHAR(32) NOT NULL default '',
 `userfield` varchar(255) NOT NULL default ''
);


****** ADDITIONAL INFORMATION ******

<inline code removed by lmadsen>
Comments:By: Leif Madsen (lmadsen) 2010-03-16 12:56:35

You can't submit changes for inclusion in Asterisk as an inline patch. Please upload your submissions as a file attachment to this issue. If you have no already signed an electronic license agreement, please do so first. Thanks!

By: precisenetworks (precisenetworks) 2010-03-17 05:10:26

Whoops!

By: Digium Subversion (svnbot) 2011-05-06 15:47:38

Repository: asterisk
Revision: 317916

A   trunk/contrib/scripts/import-cdr-csv-mysql.pl

------------------------------------------------------------------------
r317916 | russell | 2011-05-06 15:47:37 -0500 (Fri, 06 May 2011) | 7 lines

Add a cdr_csv to MySQL import script to contrib/scripts.

(closes issue ASTERISK-15818)
Reported by: precisenetworks
Patches:
     import-cdr-csv-mysql.pl uploaded by precisenetworks (license 1010)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=317916