[asterisk-bugs] [Asterisk 0010668]: Incomplete CDR lock
noreply at bugs.digium.com
noreply at bugs.digium.com
Thu Jun 5 16:50:40 CDT 2008
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: feedback
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: 06-05-2008 16:50 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.
======================================================================
Relationships ID Summary
----------------------------------------------------------------------
related to 0012726 ForkCDR application fails to set duration
======================================================================
----------------------------------------------------------------------
arkadia - 06-05-08 16:50
----------------------------------------------------------------------
>cdr_end() is OK, because it won't overwrite a previously
> set non-zero timestamp.
Yeah. But see my notes below about API. Also somebody may want to lock not
ended CDR by some reason.
>cdr_answer() will set every cdr with disp < ANSWERED to ANSWERED.
I think that's the problem. I would like to see LOCKED CDRs untouched.
>setvar will set the var on every CDR in the chain, if recur is set in
the
>options.
Note that it starts processing *cdr list from the head. Where in case of
several CDR we have an oldest probably locked CDRs. Updating just an oldest
locked CDR if recur==0 seems a little bit strange. I can understand why all
or just the latest CDR needs to be updated.
It seems we are looking on the final solutions from two different sides:
I'm more concerned about consistence of the API ast_cdr..., and you are
talking about proper work of higher level applications. I still suggest we
start looking on this issue from API level.
AST_CDR_FLAG_LOCKED is a part of public API used by developers in their
applications. Preferably this flag has constant and clear meaning like: if
CDR is marked with this flag it is not updated by any ast_cdr_....
functions.
Are we agree on that?
Any LOCKED cdr that require exception from this rule should be explicitly
tagged. E.g. ForkCDR() may have code like this:
ast_set_flag(cdr, AST_CDR_FLAG_RECURSIVE_SETVAR |
AST_CDR_FLAG_RECURSIVE_ANSWER | AST_CDR_FLAG_RECURSIVE_END);
That will allow us to do a proper fix for CDR() and ForkCDR()
Issue History
Date Modified Username Field Change
======================================================================
06-05-08 16:50 arkadia Note Added: 0087871
======================================================================
More information about the asterisk-bugs
mailing list