First you need to extract the information form the DB to a CSV File.
On MySQL you need to run the following SQL statement to extract the data:
- Code: Select all
mysql -u [username] -p [password] [Database Name]
select clid, src, dst, dcontext, channel, dstchannel, lastapp, lastdata, calldate, "", "", duration, billsec, disposition, amaflags, accountcode, uniqueid, userfield into outfile '/tmp/201106.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' from cdr where calldate like "2011-06-%";
This will give you all the data for the 6th month in 2011 and write it out to a CSV file in /tmp. Change the "2011-06-%" to the month you want to export and run the command again. Remember to also change the "/tmp/201106.csv" to a new name other wise it will overwrite your other file.
Now you can just change the TNG location that TNG uses to read the CSV file to this new file.
The file should almost immediately start processing.
You can check on the Call list screen, the "number of calls" on the top left of the page should be increasing until the file is completely processed.
Once you have completed loading all the files that you require, change TNG back to the original file name so that the live call details are loaded again.
The default location is usually:
- Code: Select all
/var/log/asterisk/cdr-custom/Master.csv
Thanks to Emile from Clarotech for the information and testing.