Best way to sync CDR to remote database

We have a setup where asterisk is on one server and our app with custom billing on another.
So we need CDR data from asterisk to another server.

Now because both servers are on internet i would like some solution that takes that as a parameter.

Obvious solution would be for us to save CDR to remote database directly from asterisk via cdr.conf.
Hoover i have read that asterisk can hang because of (remote) database problems and i dont want my calls having problems whatsoever.

So im thinking about database replication where asterisk would be master and app/billing as slave.
That would take care of sync data and other things. But is more complicated then CDR to remote database.

Does anybody have opinion about this. Am i being to cautious with CDR to remote and should just use that.

Both connections would be encrypted.

Alltough I never head problems with lost database connections while writing CDRs the scenarion may occure. In this case asterisk would not be able to save the record.

If correct storage is a must I would store the CDRs locally and transfer them lateron to the billing server. The easiest way to achieve this is indeed database replication. The replication configuration itself depends on the databases involved (However for a real database replication the dbs should be of the same venndor in the same version - eg. both MYSQL 5.1).

i found this on stackoveflow

Write the file in CSV, and then create a routine to export the CSV into your remote database ?

This would not hang asterisk since it would be a separate process.

follow the link…please.