On Fri, 11 Sep 2009, Steve Edwards wrote: >> 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.
On Fri, 11 Sep 2009, Tilghman Lesher wrote: > 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. I do check for ast_get_channel_by_name_locked() and pbx_builtin_getvar_helper() returning 0 and syslog it. It never happens in this environment. I just didn't include it in the snippet. > 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. Well shame on me. I assumed that the CDR function only operated on the "standard" set of CDR variables. Thanks for the clarification. That would clean up that section of code a bit. Unfortunately I doubt the client will pay for fixing something that isn't failing. So if a CDR exists after the channel is destroyed, when is the CDR destroyed? -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards [email protected] Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000 _______________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- AstriCon 2009 - October 13 - 15 Phoenix, Arizona Register Now: http://www.astricon.net asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
