The best way to store "live" call detail records is to write all the data fields to a temporary area on disk or RAM drive and write a script to scan that same area of the file system for the long-running processing of storing them in your database. This avoids hanging the voice call thread in FS if the http or db server is down at the end of the calls.
DO NOT write CDR scripts in the hangup hook of your dialplan or ESL script as this will delay the termination of the voice thread and will not scale to large systems. Allow the voice thread to handle only voice; handle your back-end business processes separately, off-line. This approach works for all installations from small to huge.
Popular ways include:
- mod_cdr_csv - saves a CSV file with the variables you specify in a template.
- mod_cdr_mongodb - saves detailed CDR data to a MongoDB database, in a format similar to mod_json_cdr.
- mod_odbc_cdr - saves any channel variable from call to your choice of ODBC database.
- mod_cdr_pg_csv - Asterisk Compatible CDR Module with PostgreSQL interface.
- mod_cdr_sqlite - saves directly to an sqlite DB with the variables you specify in a template.
- mod_json_cdr - Saves to file or POSTs a JSON representation of the channel variable and callflow. It can post directly to CouchDB.
- mod_xml_cdr - Saves to file or POSTs an XML representation of the channel variable and callflow.
- mod_radius_cdr - RADIUS CDR Module.
- CDR via ESL - Retrieve the CDR in an ESL event