What are the best practice for writing Call DetailRecords (CDRs) to a database? We are using custom code to write CDR-like data to logfiles and then later loading logs into a database. We have very low usage right now, so Isuspect that we could just write directly to the database. But as we scale, is it a better idea to notwrite directly to the database? Note I am not sure if we need custom CDRs or if FS' CDRmodule might be leveraged. I have tolook into that. Robert
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
On 17 July 2017 at 08:19, robert mundkowsky <rfmundkowsky@yahoo.com> wrote:
What are the best practice for writing Call Detail Records (CDRs) to a database?
Page 49 of Freeswitch Cookbook 1.6 reads in part: Frequently, it is necessary to put CDR information into a database such as PostgreSQL or other SQL and NoSQL databases. FreeSWITCH has various modules for writing CDRs directly to many databases, but the preferred architecture is writing CDRs to the disk or posting them to a web server, and then processing them so that they can be inserted into a database. Many engineering reasons lead to this architecture (for example, avoiding dependence on direct, real-time interaction with the database), and most of them relate it to integrity and resilience. https://www.packtpub.com/networking-and-servers/freeswitch-16-cookbook Following this section is mod_xml_cdr, which Steven mention in his email.
There is also mod_format_cdr which covers both json and XML formats. -- Nathan On 7/18/17 10:24 AM, jungle Boogie wrote:
On 17 July 2017 at 08:19, robert mundkowsky <rfmundkowsky@yahoo.com> wrote:
What are the best practice for writing Call Detail Records (CDRs) to a database?
Page 49 of Freeswitch Cookbook 1.6 reads in part: Frequently, it is necessary to put CDR information into a database such as PostgreSQL or other SQL and NoSQL databases. FreeSWITCH has various modules for writing CDRs directly to many databases, but the preferred architecture is writing CDRs to the disk or posting them to a web server, and then processing them so that they can be inserted into a database. Many engineering reasons lead to this architecture (for example, avoiding dependence on direct, real-time interaction with the database), and most of them relate it to integrity and resilience.
https://www.packtpub.com/networking-and-servers/freeswitch-16-cookbook
Following this section is mod_xml_cdr, which Steven mention in his email.
_________________________________________________________________________ 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
-- ------------------------------------------------------------ Nathan Neulinger nneul@mst.edu Missouri S&T Information Technology (573) 612-1412 System Administrator - Architect
Hi Robert A while back we had similar considerations regarding CDR. What we ended up with, was to use the JSON CDR module for writing the records to disk. Then we used an custom tool[1] to upload the files to Google Cloud, where they may be indexed further. The main idea was to store as much data as possible, as it may come in handy later. Also, the database module seemed to lack some of the information that we needed (eg. custom variables). This worked very well for us, as we did not know from day 1 what information could be useful, and storing everything solved exactly that. Have fun! /Kim [1] https://github.com/Bitstackers/openreception/tree/master/tools/cdrctl On 2017-07-17 17:19, robert mundkowsky 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
participants (5)
-
jungle Boogie
-
Kim Rostgaard Schomacker
-
Nathan Neulinger
-
robert mundkowsky
-
Steven Ayre