[asterisk-users] MySql and custom CDR
Tilghman Lesher
tlesher at digium.com
Fri Sep 11 15:48:15 CDT 2009
On Friday 11 September 2009 02:04:05 pm Steve Edwards wrote:
> > 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.
1) There's no guarantee that the channel will still be alive at the time the
CDR is posted. In fact, if you're doing bulk posting of CDRs, it's pretty
much guaranteed the channel will be gone.
2) CDR variables were created for exactly this reason -- they are allocated
to the CDR, not the channel, and thus, they are available even after the
channel is destroyed. They are available to use in 1.2.
--
Tilghman
More information about the asterisk-users
mailing list