[asterisk-bugs] [Asterisk 0010668]: Incomplete CDR lock

noreply at bugs.digium.com noreply at bugs.digium.com
Tue Sep 11 10:14:42 CDT 2007


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=10668 
====================================================================== 
Reported By:                arkadia
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   10668
Category:                   CDR/General
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
Asterisk Version:           1.4.11  
SVN Branch (only for SVN checkouts, not tarball releases):  1.4  
SVN Revision (number only!):  
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             09-07-2007 08:26 CDT
Last Modified:              09-11-2007 10:14 CDT
====================================================================== 
Summary:                    Incomplete CDR lock
Description: 
This is all about the meaning of AST_CDR_FLAG_LOCKED flag for CDR. 
I assume if CDR has this flag set then it wont be updated anymore by any
ast_cdr_ functions except cases when we force such update. ast_cdr_reset()
is example of function which allows to update locked CDRs if special flag
is given.

Based on this assumption I prepared the patch with such changes:

  ast_cdr_setvar() - not allowed to touch locked CDRs. I don't see any
cases when we need to change locked CDRs too. Not touching locked CDRs is
helpfull when ForkCDR being used and every new CDR may have different
custom variables.

  ast_cdr_answer() - don't change status of locked CDRs. That might be
helpfull when we have a chain of CDRs for one incoming call for which we
perform several tries to make outgoing call. Every outgoing attempt may
finish with its own completion code. And if the final attempt is 'answered'
then we have only one CDR with 'answered' status. All other will keep
connection error codes which is very helpful for error monitoring.

 ast_cdr_end() - don't change locked CDRs by the same reason as
ast_cdr_answer()

As there will be no changes in CDR after lock, app_forkcdr.c should be
updated to end original locked CDR.
Also it'll be great to make optional cdr reset in this application, but
thats a theme for another patch.
====================================================================== 

---------------------------------------------------------------------- 
 murf - 09-11-07 10:14  
---------------------------------------------------------------------- 
While I agree with most of your statements, I am afraid (yes, I feel FEAR),
that the one change to end the current CDR before locking it, is a
non-compatible fix. It's the first glob in the patch.

Why am I afraid to make this change? Because I have no idea how many
forkCDR users are counting on the fact that CDR's are ended on hangup, not
on forking.

While there is absolutely no documentation associated with forkCDR, and
nothing states its purpose, design goals, or philosophy, right now it
implicily creates a stack of CDRs, of which the top CDR on the stack is the
one that is supposed to get all the mods/updates. They are all closed out
on hangup.

Changing this would probably break all current usage, and cause the
collapse of the economies of several small countries. Civil war would most
likely break out in several others. Undoubtedly, the balance of world power
would be shifted, and ... everybody would point at me, and yell "He did
it!!!!".

Instead, it might be safer to come up with a new app, or better yet, an
option to forkCDR to end the preceding CDR. This way, existing code won't
break, and we won't have the death of thousands on our consciences! What do
you think? 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
09-11-07 10:14  murf           Note Added: 0070325                          
======================================================================




More information about the asterisk-bugs mailing list