Knowledgebase
How to enable CDR on AsteriskNOW and FreePBX Print this Article
How to enable CDR on AsteriskNOW and FreePBX
Installing the following yum packages:
yum install asterisk-odbc
Modify the config files:
Setup your config files like the following. If you have changed your database usernames/passwords from the default install you might need to make adjustments below.
[root@pbx asterisk]# cat /etc/odbc.ini
[MySQL-asteriskcdrdb]
Driver = MySQL
Description = MySQL connection to 'asteriskcdrdb' database
Server = localhost
Port = 3306
Database = asteriskcdrdb
Option = 3
Socket =
[root@pbx asterisk]# cat /etc/asterisk/cdr_odbc.conf
;
; cdr_odbc.conf
;
[global]
dsn=asteriskcdrdb
loguniqueid=yes
dispositionstring=yes
table=cdr ;"cdr" is default table name
[root@pbx asterisk]# cat /etc/asterisk/cdr.conf
SHOULD BE EMPTY.
THIS SHOULD ALREADY BE SET:
[root@pbx asterisk]# cat /etc/asterisk/cdr_mysql.conf
;
; Note - if the database server is hosted on the same machine as the
; asterisk server, you can achieve a local Unix socket connection by
; setting hostname = localhost
;
; port and sock are both optional parameters. If hostname is specified
; and is not "localhost", then cdr_mysql will attempt to connect to the
; port specified or use the default port. If hostname is not specified
; or if hostname is "localhost", then cdr_mysql will attempt to connect
; to the socket file specified by sock or otherwise use the default socket
; file.
;
[global]
hostname = localhost
dbname=asteriskcdrdb
password = fpbx
user = freepbx
userfield=1
;port=3306
;sock=/tmp/mysql.sock
Now restart Asterisk:
[root@pbx asterisk]# amportal restart
Open Asterisk Console:
[root@pbx asterisk]# asterisk -rvvv
Check Asterisk CDR Module Status:
pbx*CLI> cdr show status
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log unanswered calls: No
* Registered Backends
-------------------
Adaptive ODBC
ODBC
cdr-custom
pbx*CLI> odbc show all
ODBC DSN Settings
-----------------
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Last connection attempt: 1969-12-31 18:00:00
Pooled: No
Connected: Yes
You should now be able to pull data from the CDR table.
Installing the following yum packages:
yum install asterisk-odbc
Modify the config files:
Setup your config files like the following. If you have changed your database usernames/passwords from the default install you might need to make adjustments below.
[root@pbx asterisk]# cat /etc/odbc.ini
[MySQL-asteriskcdrdb]
Driver = MySQL
Description = MySQL connection to 'asteriskcdrdb' database
Server = localhost
Port = 3306
Database = asteriskcdrdb
Option = 3
Socket =
[root@pbx asterisk]# cat /etc/asterisk/cdr_odbc.conf
;
; cdr_odbc.conf
;
[global]
dsn=asteriskcdrdb
loguniqueid=yes
dispositionstring=yes
table=cdr ;"cdr" is default table name
[root@pbx asterisk]# cat /etc/asterisk/cdr.conf
SHOULD BE EMPTY.
THIS SHOULD ALREADY BE SET:
[root@pbx asterisk]# cat /etc/asterisk/cdr_mysql.conf
;
; Note - if the database server is hosted on the same machine as the
; asterisk server, you can achieve a local Unix socket connection by
; setting hostname = localhost
;
; port and sock are both optional parameters. If hostname is specified
; and is not "localhost", then cdr_mysql will attempt to connect to the
; port specified or use the default port. If hostname is not specified
; or if hostname is "localhost", then cdr_mysql will attempt to connect
; to the socket file specified by sock or otherwise use the default socket
; file.
;
[global]
hostname = localhost
dbname=asteriskcdrdb
password = fpbx
user = freepbx
userfield=1
;port=3306
;sock=/tmp/mysql.sock
Now restart Asterisk:
[root@pbx asterisk]# amportal restart
Open Asterisk Console:
[root@pbx asterisk]# asterisk -rvvv
Check Asterisk CDR Module Status:
pbx*CLI> cdr show status
Call Detail Record (CDR) settings
----------------------------------
Logging: Enabled
Mode: Simple
Log unanswered calls: No
* Registered Backends
-------------------
Adaptive ODBC
ODBC
cdr-custom
pbx*CLI> odbc show all
ODBC DSN Settings
-----------------
Name: asteriskcdrdb
DSN: MySQL-asteriskcdrdb
Last connection attempt: 1969-12-31 18:00:00
Pooled: No
Connected: Yes
You should now be able to pull data from the CDR table.
Was this answer helpful?
Related Articles
Error after upgrade AsteriskNOW and FreePBX
Yum upgrade breaks AsteriskNOW and FreePBX After yum updating AsteriskNOW 2.0 I was getting...
Yum upgrade breaks AsteriskNOW and FreePBX After yum updating AsteriskNOW 2.0 I was getting...
XHR response code: 200 XHR responseText: undefined jQuery status: parsererror
After yum update you get an rrror on web interface:XHR response code: 200 XHR responseText:...
After yum update you get an rrror on web interface:XHR response code: 200 XHR responseText:...