[asterisk-users] MySql and custom CDR

Steve Edwards asterisk.org at sedwards.com
Fri Sep 11 14:04:05 CDT 2009


> On Friday 11 September 2009 11:05:36 am Patrick wrote:
>>
>> I've migrated from CSV CDR to MySql CDR and the customization of my 
>> CDR's is not working anymore.
>>
>> Do you know if the cdr_mysql is supporting custom cdr's ? If not, is 
>> there any alternative/workaround ?

On Fri, 11 Sep 2009, Tilghman Lesher wrote:

> This module doesn't support custom CDRs, but starting in 1.6.0, it 
> supports something even better:  the ability to automatically map CDR 
> variables directly into columns of the same name.  You can also alias 
> various CDR variables into columns of different names, with the 
> [aliases] configuration section.  See the sample configuration file for 
> more details.

I'm a 1.2 Luddite, but I found cdr_addon_mysql.c pretty easy to hack on. 
For example, I added a channel variable named PRODUCT. Here's the code I 
used:

 	channel_pointer = ast_get_channel_by_name_locked(channel);
 	product_pointer = pbx_builtin_getvar_helper(channel_pointer
 		, "PRODUCT");

and then add ",product", ",'%s'" and product_pointer to the sprintf that 
builds the insert statement.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list