Again i am very new to Asterisk so please don`t ridicule me for asking stupid questions. I have a new installation of Asterisk 11 ,i need to export the CDR records in a .csv format to an external SFTP/FTP server. Is this possible ? Could anyone perhaps assist me with some steps or maybe even a reference to a document ?
Most Welcome @rcoetzee,
I think you need to create PHP Script with follwoing steps:
- Connect to CDR DB
- Your sql
- generate CSV
- connect to your external server
- upload CSV to server
Hope this to be helpful.
Thanks for the reply. As far as i can tell there is a way to generate the CDR files in .csv format. It is stored in /var/log/asterisk/cdr-csv/master.csv. So i guess my first question is if Asterisk will store it here by default or if i need to edit some conf file. Secondly i need to create some script that will copy this master.csv file into a custom.csv file every “XX” seconds and then that file needs to be copied to External FTP server using scp or equivalent.
Very good to know,
For second part I think you can but scp in bash file and use watch to run it periodically:
watch -n 10 path/to/script.sh
It depends on how you configure your CDR.
The CSV and Custom Backends both will write to csv files on the host asterisk is running on.
Hi thanks for the reply ,another question ,how do i get the CSV backend registered , see below output Call Detail Record (CDR) settings
Log unanswered calls: Yes
Log congestion: No
Registered BackendsAdaptive ODBC
The module name is cdr_csv.so
You can do a ‘module load cdr_csv.so’ from the console if you have compiled it.
You can add it to the modules that are loaded on startup by adjusting your modules.conf file.
Awesome thanks for all the replies guys ,managed to get a bash script for this ,ended up only rewriting files if the size was more than 1mb