Resolved: CDR logging to postgres database problem

Running Asterisk 4.6_beta9
brand new to asterisk; I do have it up and running, connected to a sip provider and passing calls around.

I am trying to post the cdr messages to a postgres database. Everything seems to start-up correctly and all but in the end it fails to insert the rows.

I’ve validated that the odbc connection works by logging into postgres via the odbc connection. I can see the table in postgres so I know it is there.

I even validated that I could inert rows into the cdr table in the asterisk database with the user configured to log in.

Asterisk start up I see this in the message file:

[Jul 25 12:45:36] NOTICE[26920] config.c: Registered Config Engine odbc
[Jul 25 12:45:36] NOTICE[26920] res_odbc.c: Connecting asterisk
[Jul 25 12:45:36] NOTICE[26920] res_odbc.c: res_odbc: Connected to asterisk [asteriskConnector]
[Jul 25 12:45:36] NOTICE[26920] res_odbc.c: Registered ODBC class ‘asterisk’ dsn->[asteriskConnector]
[Jul 25 12:45:36] NOTICE[26920] res_odbc.c: res_odbc loaded.

from the CLI>
phonesysCLI> odbc show
ODBC DSN Settings

Name: asterisk
DSN: asteriskConnector
Pooled: No>
Connected: Yes

phonesys*CLI> cdr show status
CDR logging: enabled
CDR mode: simple
CDR output unanswered calls: yes
CDR registered backend: ODBC
CDR registered backend: Adaptive ODBC

Now when a transaction comes through and it goes to write a rule to the database I get this error:

[Jul 25 12:47:41] ERROR[26920]: cdr_odbc.c:133 odbc_log: Unable to retrieve database handle. CDR failed.

my res_odbc.conf looks like:
enabled => yes
dsn => asteriskConnector
username => asterisk
password =>
pooling => no
limit => 10
pre-connect => yes

and my cdr_odbc.conf looks like:
table=cdr ;“cdr” is default table name
usegmtime=yes ; set to “yes” to log in GMT

I’ve pretty much run out of ideas of what to look at and try; any direction would be much appreciated.


I found the issue; in 4.6 you need to have the cdr_odbc.conf file point back to the res_odbc.conf file entry for the DSN you are trying to hit.