Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Asterisk save cdr on Mysql

Status
Not open for further replies.

lexer

Programmer
Jun 13, 2006
432
VE
Hi

I've got an Asterisk 11.8.1 installed on a debian server, I want to save cdr records in a Mysql Table, I called the Mysql database "asteriskcdr" and the mysql table "cdr". I already installed Mysql.

I search on google and I found that I'v got to setup the following asterisk files: /etc/odbc.ini --- /etc/asterisk/res_odbc.conf and /etc/asterisk/cdr_adaptive_odbc.conf

Here the information for each file:

/etc/odbc.ini:

[asteriskcdr]
Description = MySQL ODBC CDR
Driver = MySQL
Database = asteriskcdr
Server = localhost
User = root
Password = password
Port = 3306
Option = 3

/etc/asterisk/res_odbc.conf :

[asteriskcdr]
enabled => yes
dsn => asteriskcdr
username => root
password => password
pre-connect => yes

/etc/asterisk/cdr_adaptive_odbc.conf :

[asteriskcdr]
connection=asteriskcdr
table=cdr
alias start => calldate

The following commands show:

*CLI> module show like cdr_adaptive_odbc.so
Module Description Use Count
cdr_adaptive_odbc.so Adaptive ODBC CDR backend 0
1 modules loaded

root@debian:~# isql asteriskcdr root asteriskcdr
[ISQL]ERROR: Could not SQLConnect

*CLI> module reload res_odbc.so
-- Reloading module 'res_odbc.so' (ODBC resource)
== Parsing '/etc/asterisk/res_odbc.conf': Found
[Mar 28 13:15:32] NOTICE[7721]: res_odbc.c:1527 odbc_obj_connect: Connecting asteriskcdr
[Mar 28 13:15:32] WARNING[7721]: res_odbc.c:1552 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[Mar 28 13:15:32] WARNING[7721]: res_odbc.c:1367 _ast_odbc_request_obj2: Failed to connect to asteriskcdr
[Mar 28 13:15:32] NOTICE[7721]: res_odbc.c:919 load_odbc_config: Registered ODBC class 'asteriskcdr' dsn->[asteriskcdr]


*CLI> module reload cdr_adaptive_odbc.so
-- Reloading module 'cdr_adaptive_odbc.so' (Adaptive ODBC CDR backend)
== Parsing '/etc/asterisk/cdr_adaptive_odbc.conf': Found
[Mar 28 13:20:00] NOTICE[7726]: res_odbc.c:1527 odbc_obj_connect: Connecting asteriskcdr
[Mar 28 13:20:00] WARNING[7726]: res_odbc.c:1552 odbc_obj_connect: res_odbc: Error SQLConnect=-1 errno=0 [unixODBC][Driver Manager]Data source name not found, and no default driver specified
[Mar 28 13:20:00] WARNING[7726]: res_odbc.c:1367 _ast_odbc_request_obj2: Failed to connect to asteriskcdr
[Mar 28 13:20:00] WARNING[7726]: cdr_adaptive_odbc.c:126 load_config: No such connection 'asteriskcdr' in the 'asteriskcdr' section of cdr_adaptive_odbc.conf. Check res_odbc.conf.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| asterisk |
| asteriskcdr |
| mysql |
| performance_schema |
+--------------------+
5 rows in set (0.00 sec)

mysql> use asteriskcdr;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> show tables;
+-----------------------+
| Tables_in_asteriskcdr |
+-----------------------+
| cdr |
+-----------------------+
1 row in set (0.00 sec)

The cdr table is empty calls from asterisk are being recorded in the cdr table.

Please, any ideas to see what happening?



 
I use FreePBX.

Edit /etc/amportal.conf, change the following settings to match your mysql server:

# AMPDBHOST: the host to connect to the database named 'asterisk'
AMPDBHOST=localhost
# AMPDBUSER: the user to connect to the database named 'asterisk'
AMPDBUSER=asteriskuser
# AMPDBPASS: the password for AMPDBUSER
AMPDBPASS=amp109

# CDR DB Settings: Only used if you dont use the default values provided by freepbx.
# CDRDBHOST: hostname of db server if not the same as AMPDBHOST
# CDRDBPORT: Port number for db host
# CDRDBUSER: username to connect to db with if its not the same as AMPDBUSER
# CDRDBPASS: password for connecting to db if its not the same as AMPDBPASS
# CDRDBNAME: name of database used for cdr records
# CDRDBTABLENAME: Name of the table in the db where the cdr is stored cdr is default

Clowns to the left of me, jokers to the right, here I am, stuck in the middle with you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top