Need some help with CDR logging

We have an old Trixbox server in place that does one thing only: terminate calls for _5[0-1]XX. The box also logs these calls as ANSWERED in a MySQL db. There is also a custom written service that transfer records from that MySQL to a remote MSSQL server.

I need to replace this box with a new FreePBX on a VM and do the same work, this time using native CDR/CEL logging to MSSQL via FreeTDS.

I managed to set up the new box with the most recent AsteriskNow iso and created the inbound route, installed freetds and configured the cdr but I’m having some issues:

  1. FreePBX always revert back (in the file res_odbc_additional.conf) to using DSN [MySQL-asteriskcdrdb]

  2. The CDR logging wasn’t working because of the “end” field in the insert statement without square brackets. I had to put alias [end] => end in the file cdr_adaptive_odbc.conf. Now I see the cdr table being populated but the end column is always filled withh NULL values. Is it normal?

  3. The CEL logging wasn’t working because the eventtime field has too many decimals for a MSSQL datetime field (example: 2015-11-03 15:37:17.309523). I also tried to make it a datetime2[6] type but still doesn’t work with ODBC syntax. I had to change it to varchar type. Is there a way to force Asterisk to cut down to 3 decimals?

  4. On the old Trixbox server, the terminated calls shows up in the CDR log as ANSWERED and I can see the src and dst numbers. On the new FreePBX I hade to put [general] unanswered = yes in the cdr.conf file and the records do not show the correct destination number (they show “hangup” and app-blackhole as dcontext). At this time I’m joining data with CEL table to get the correct destination number but I would be cleaner to get it written in the CDR table in the first place. How can I do this?

Thanks to all. Bye