[Asterisk-Users] MySQL CDR addon problem

Shilliday, Jim JShilliday at ejcenter.org
Fri Oct 15 14:11:00 MST 2004


I thought I had this resolved, but apparently not.  Every call generates
this:

	Oct 15 16:54:19 ERROR[1115579712]: cdr_addon_mysql.c:200
mysql_log: 	Failed to insert into database.

We know from the mysql log that * is connecting to MySQL:

	041015 16:14:02	     12 Connect     asterisk at localhost on
asteriskcdrdb

According to the MySQL log, * is trying to do this:

	041015 16:54:19	     12 Query       INSERT INTO cdr
(calldate,clid,src,dst,dcontext,channel,dstchannel,lastapp,lastdata,dura
tion,billsec,disposition,amaflags,accountcode,userfield) VALUES
('2004-10-15 16:53:56','\"Jim\" <7401>','7401','7368','outgoing',
'SIP/Ciscoe7f578-a503','SIP/Ciscod66bbf-1-55da','Hangup','',23,3,'ANSWER
ED',3,'','')

Here's the table structure (I set those "allow nulls" while trying to
solve this problem):

mysql> describe cdr;
+-------------+--------------+------+-----+---------------------+-------
+
| Field       | Type         | Null | Key | Default             | Extra
|
+-------------+--------------+------+-----+---------------------+-------
+
| userfield   | varchar(255) | YES  |     | NULL                |
|
| accountcode | varchar(20)  | YES  |     | NULL                |
|
| src         | varchar(80)  |      |     |                     |
|
| dst         | varchar(80)  |      |     |                     |
|
| dcontext    | varchar(80)  |      |     |                     |
|
| clid        | varchar(80)  |      |     |                     |
|
| channel     | varchar(80)  |      |     |                     |
|
| dstchannel  | varchar(80)  | YES  |     | NULL                |
|
| lastapp     | varchar(80)  | YES  |     | NULL                |
|
| lastdata    | varchar(80)  | YES  |     | NULL                |
|
| calldate    | datetime     |      |     | 0000-00-00 00:00:00 |
|
| duration    | int(11)      |      |     | 0                   |
|
| billsec     | int(11)      |      |     | 0                   |
|
| disposition | varchar(45)  |      |     |                     |
|
| amaflags    | int(11)      | YES  |     | NULL                |
|
+-------------+--------------+------+-----+---------------------+-------
+
15 rows in set (0.00 sec)

I'm pretty sure the permissions are right:

	Mysql>  show grants for asterisk at localhost;

	GRANT SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES ON
*.* TO 	'asterisk'@'localhost' IDENTIFIED BY PASSWORD 'yadayada'
	GRANT ALL PRIVILEGES ON `asteriskcdrdb`.`asteriskcdrdb` TO
'asterisk'@'localhost' WITH GRANT OPTION


If there's a specific error message from MySQL in response to the
INSERT, I haven't been able to locate it.  Ideas anyone?

Thanks

Jim Shilliday



More information about the asterisk-users mailing list