Cdr


#1

Hi
I need help ! I enabled the cdr in cdr.conf but I can not have [color=brown]CDR registered backend : mysq[/color]l

I just have this : "
[color=green]*CLI> cdr status
CDR logging: enabled
CDR mode: simple
CDR registered backend: cdr_manager
CDR registered backend: csv
CDR registered backend: cdr-custom[/color] "

I check res_mysql.conf and cdr_mysql.conf but nothing !
Thanks to help me !
Aicha


#2

After you installed the cdr_mysql add-on (asterisk-addons), did you add load=cdr_addon_mysql.so entry to modules.conf and restart Asterisk? Also, don’t forget to create a mysql user account/password that matches the one in your cdr_mysql.conf when you create the cdr table in your new database. Here’s the script incase you don’t have it.

CREATE DATABASE asterisk; 

GRANT INSERT 
  ON asterisk.* 
  TO asteriskaccount
  IDENTIFIED BY 'asteriskpassword'; 

USE asterisk; 

CREATE TABLE `cdr` ( 
`calldate` datetime NOT NULL default '0000-00-00 00:00:00', 
`clid` varchar(80) NOT NULL default '', 
`src` varchar(80) NOT NULL default '', 
`dst` varchar(80) NOT NULL default '', 
`dcontext` varchar(80) NOT NULL default '',  
`channel` varchar(80) NOT NULL default '', 
`dstchannel` varchar(80) NOT NULL default '', 
`lastapp` varchar(80) NOT NULL default '', 
`lastdata` varchar(80) NOT NULL default '', 
`duration` int(11) NOT NULL default '0', 
`billsec` int(11) NOT NULL default '0', 
`disposition` varchar(45) NOT NULL default '',  
`amaflags` int(11) NOT NULL default '0', 
`accountcode` varchar(20) NOT NULL default '', 
`userfield` varchar(255) NOT NULL default '' 
); 

ALTER TABLE `cdr` ADD INDEX ( `calldate` ); 
ALTER TABLE `cdr` ADD INDEX ( `dst` ); 
ALTER TABLE `cdr` ADD INDEX ( `accountcode` );   

#3

Hi
I already created a account with a password .
and they match with the file cdr_mysql.conf .
Is it the only think to change?
when I reload asterisk I got :
[color=green]
[app_directory.so] => (Extension Directory)
== Registered application ‘Directory’
[cdr_addon_mysql.so] => (MySQL CDR Backend)
== Parsing ‘/etc/asterisk/cdr_mysql.conf’: Found
Apr 19 11:57:21 WARNING[6707]: config.c:499 process_text_line: parse error: No category context for line 14 of cdr_mysql.conf
Apr 19 11:57:21 WARNING[6707]: cdr_addon_mysql.c:295 my_load_module: Unable to load config for mysql CDR’s: cdr_mysql.conf[/color]

And my cdr_mysql is like this :
[color=green]
;
; 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=asterisk
;table=cdr
password=
user=root
;port=3306
;sock=/var/lib/mysql/mysql.sock
;userfield=1[/color]

Thanks
Aicha


#4

Uncomment [global]


#5

THANKS YOU to all :smiley: :laughing:
I forgot the ; before global !
But I ll comme back with others problemes ! :stuck_out_tongue:
Thanks again ! love you !
Aicha


#6

I’m also getting this error on my system:

[cdr_addon_mysql.so] => (MySQL CDR Backend)
== Parsing ‘/etc/asterisk/cdr_mysql.conf’: Found
May 1 20:55:44 ERROR[371]: cdr_addon_mysql.c:438 my_load_module: Failed to connect to mysql database asteriskcdrdb on localhost.

Where does this script go?

CREATE DATABASE asterisk;

GRANT INSERT
ON asterisk.*
TO asteriskaccount
IDENTIFIED BY ‘asteriskpassword’;

USE asterisk;

CREATE TABLE cdr (
calldate datetime NOT NULL default ‘0000-00-00 00:00:00’,
clid varchar(80) NOT NULL default ‘’,
src varchar(80) NOT NULL default ‘’,
dst varchar(80) NOT NULL default ‘’,
dcontext varchar(80) NOT NULL default ‘’,
channel varchar(80) NOT NULL default ‘’,
dstchannel varchar(80) NOT NULL default ‘’,
lastapp varchar(80) NOT NULL default ‘’,
lastdata varchar(80) NOT NULL default ‘’,
duration int(11) NOT NULL default ‘0’,
billsec int(11) NOT NULL default ‘0’,
disposition varchar(45) NOT NULL default ‘’,
amaflags int(11) NOT NULL default ‘0’,
accountcode varchar(20) NOT NULL default ‘’,
userfield varchar(255) NOT NULL default ‘’
);

ALTER TABLE cdr ADD INDEX ( calldate );
ALTER TABLE cdr ADD INDEX ( dst );
ALTER TABLE cdr ADD INDEX ( accountcode );


my cdr_mysql.conf reads:

;
; 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
table=cdr
password=
user=root
port=3306
sock=/tmp/mysql.sock
userfield=1

Your thoughts?


#7

mistyphiRazz,

Please don’t double post, it makes it too confusing. I answered this question in your other post.

Scott


#8

hi
are you sure that you put the right path of the socket ?
type locate mysql.sock to be sure.
Aicha