Custom code is probably not the correct way to generate logs that you're using as CDRs. It won't run in the CS_REPORTING state which is the best place to generate CDRs. As for writing direct to the database there are modules for that (eg mod_odbc_cdr) but you can't rely on that alone, especially as you scale up. The database might be unavailable, have reached the maximum number of connections, or have locked tables. You need to be able to support spooling CDRs that aren't written to the DB and retrying later. See csv-path-on-fail for mod_odbc_cdr. Personally I prefer mod_xml_cdr as it can post the CDRs to a web farm for processing, and we can change their processing in that application if we want extra information in future. That spools via err-log-dir. I'd also suggest something like mod_xml_cdr or at least something like mod_cdr_csv so that you can archive CDRs outside of the database. That way if your database fails or gets corrupted you have a backup copy, or something to reconcile against. On 17 July 2017 at 16:19, robert mundkowsky <rfmundkowsky@yahoo.com> wrote:
What are the best practice for writing Call Detail Records (CDRs) to a database?
We are using custom code to write CDR-like data to log files and then later loading logs into a database. We have very low usage right now, so I suspect that we could just write directly to the database. But as we scale, is it a better idea to not write directly to the database?
Note I am not sure if we need custom CDRs or if FS' CDR module might be leveraged. I have to look into that.
Robert
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org