External CDR Database

I’ve gone through a barrage of different web articles on setting up an external cdr database (using MS SQL Server). I tried using the settings in “Advanced Settings” to set this up, but I’m getting a weird error
[FATAL] SQLSTATE[HY000] [2013] Lost connection to MySQL server at ‘reading initial communication packet’, system error: 104 SQLSTATE[HY000] [2013] Lost connection to MySQL server at ‘reading initial communication packet’, system error: 104

Some articles have suggested recompiling Asterisk and setting up ODBC support. I guess I’m a little afraid to do that on a FreePBX distro. Anyone have any ideas?


Are these different (Microsoft SQL Server vs MySQL) on purpose?

I don’t know why they are different. I am trying to connect to a MS SQL Server using the built in settings under Advanced Settings. Is there a different method I should be using?


FreePBX does not support MS SQL. That is what @cynjut is trying to imply.

Oh, so there is no way I can export CDR’s to MS SQL?


Export sure. But what you are doing is not an export. You are trying to connect FreePBX to your MS SQL server to read from. I think you are using the word export wrong.

To get MS SQL to work you’d first have to create the correct DBs in MS SQL. Then adjust Advanced Settings and they hard code mssql into a few places. It’s not trivial and it’s never been tested.

Oh, I gotcha. I’m looking to dump CDR’s to MS SQL. How do I do that?


You’ll have to look at google. That’s outside the scope of FreePBX

OK, so it would be Asterisk dumping CDR’s, not Freepbx?


Also, does the latest version of FPBX Distro come with Asterisk and ODBC support or do I have to recompile Asterisk?


It comes with ODBC but are you talking about dumping/exporting or connecting. Exporting/dumping would mean a one time thing.

OK, I mean to continuously send CDRs to the MSSQL database on every call. Is that possible?


No. You can’t get there from here without a lot of new code.

That’s what we’ve been trying to tell you. You can use MySQL, but that it completely different than MS SQL.

It’s like asking if I can put a Mercedes body on a Citroen. If you have the right tools and experience, you can probably get it done. If you don’t have that kind of experience, it’s not likely to end up what you are hoping for.

1 Like

Dear it is possible to use RADIUS ? I mean connect FreePBX CDR to RADIUS server.
Some customers ask about this.

Not for the faint of heart and would require a total rebuild of asterisk from source, but if you are a “brave-heart”


and in general for this thread:-


1 Like

Thanks Dicko.
Just a tiny question: we can have both? I mean current MySQL backend remains and RADIUS will be added.

Really all very well covered with Digium authority in my links.

(As a hint you already have two, “backends” , odbc/mysql and csv)

1 Like