Summary:ASTERISK-11117: use additional mysql fields based on CDR variables
Reporter:Benjamin Lawetz (benthos)Labels:
Date Opened:2007-12-27 12:55:35.000-0600Date Closed:2007-12-30 11:11:57.000-0600
Versions:Frequency of
Environment:Attachments:( 0) 20071230__bug11642.diff.txt
( 1) cdr_addon_mysql-1.2.8.patch
( 2) cdr_addon_mysql-1.4.5.patch
( 3) cdr_mysql.conf.sample-1.4.5.patch
Description:I wrote a small patch to be able to insert into the mysql CDR additionnal variables that have been set using Set(CDR(variable)).
A additionalfields variable is loaded from cdr_mysql.conf with pipe seperated additional fields to take into account.

The patch searches through the CDR variables for one of the additionnal fields, and if present adds it to the mysql query.


Default behaviour stays the same.
Only fields specified in the cdr_mysql.conf and which are set for the call will be taken into account.
There might be problems if trying to insert wrong type variables. Haven't fully tested.
If the mysql table is to adjusted properly to reflect what's it the cdr_mysql.conf, mysql insertion will fail.

Second time sending in a patch and haven't written C code in a while, so if there are modifications or recommendations, feel free to mention.
Comments:By: Jason Parker (jparker) 2007-12-27 14:45:29.000-0600

This is basically the same as cdr_adaptive_odbc, which automatically finds fields, and is already in tree.

I don't know whether we want to go this route or not..

By: Sergey Tamkovich (sergee) 2007-12-28 02:25:51.000-0600

qwell, why not?

as far as i understand odbc and mysql are completley different and independent backends. So I believe that features in cdr_mysql should not depend on cdr_addaptive_odbc.

After all, cdr_sqlite3_custom and cdr_custom doesn't prevent cdr_addaptive_odbc's existence, right?

By: Benjamin Lawetz (benthos) 2007-12-28 12:18:55.000-0600

Added patch  cdr_addon_mysql-1.2.8.patch for asterisk-addons-1.2.8

By: Jason Parker (jparker) 2007-12-28 12:39:38.000-0600

Any new features would need to be against trunk, and not 1.2 or 1.4

By: Tilghman Lesher (tilghman) 2007-12-28 13:03:17.000-0600

Also, it would probably be good if you mirrored the functionality of cdr_adaptive_odbc, in terms of scanning the table and adapting to the existing fields

By: Tilghman Lesher (tilghman) 2007-12-28 16:19:41.000-0600

Okay, I've mirrored cdr_adaptive_odbc's functionality in cdr_addon_mysql.  This still needs a good deal of testing before it can be committed, though.

By: Tilghman Lesher (tilghman) 2007-12-28 16:37:53.000-0600

The other benefit of doing it like this is that you can remove arbitrary fields, too.

By: Tilghman Lesher (tilghman) 2007-12-30 10:20:54.000-0600

New patch uploaded, for trunk, tested and working.

By: Digium Subversion (svnbot) 2007-12-30 11:11:57.000-0600

Repository: asterisk-addons
Revision: 501

A   trunk/UPGRADE.txt
U   trunk/cdr_addon_mysql.c
U   trunk/configs/cdr_mysql.conf.sample

r501 | tilghman | 2007-12-30 11:11:56 -0600 (Sun, 30 Dec 2007) | 3 lines

Make cdr_addon_mysql work like cdr_adaptive_odbc... dynamic columns
(Closes issue ASTERISK-11117)