[asterisk-bugs] [Asterisk 0013251]: endbeforehexten=yes is useless now

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Aug 21 17:54:56 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13251 
====================================================================== 
Reported By:                sergee
Assigned To:                murf
====================================================================== 
Project:                    Asterisk
Issue ID:                   13251
Category:                   CDR/General
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
SVN Branch (only for SVN checkouts, not tarball releases): 1.6.0 
SVN Revision (number only!): 135435 
Disclaimer on File?:        N/A 
Request Review:              
====================================================================== 
Date Submitted:             2008-08-06 15:10 CDT
Last Modified:              2008-08-21 17:54 CDT
====================================================================== 
Summary:                    endbeforehexten=yes is useless now
Description: 
1. Part of code:

  if (c->cdr && ast_opt_end_cdr_before_h_exten)
	                         ast_cdr_end(c->cdr);

- missing (this is how it was
http://svn.digium.com/view/asterisk/trunk/pbx.c?r1=12896&r2=12895&pathrev=12896)

2. I have very simple scenario SIP/A calls SIP/B they talk 30 seconds,
then call is finished. Even after i call ast_cdr_end(chan->cdr) - manually
from my app,  these fields aren't initialized:

chan->cdr->billsec == 0,
chan->cdr->duration == 0,
chan->cdr->answer.tv_sec == 0,
chan->cdr->end.tv_sec == 0

3. as far as i understand, CDRs are posted now as soon as channels are
unbridged. This behavior breaks billings which make calculations inside 'h'
extensions. It would be nice to post CDRs after no more apps are left in
the 'h' extension or to have an application in the DialPlan, something like
CDRPost().

====================================================================== 

---------------------------------------------------------------------- 
 (0091636) svnbot (reporter) - 2008-08-21 17:54
 http://bugs.digium.com/view.php?id=13251#c91636 
---------------------------------------------------------------------- 
Repository: asterisk
Revision: 139347

U   branches/1.4/main/pbx.c
U   branches/1.4/res/res_features.c

------------------------------------------------------------------------
r139347 | murf | 2008-08-21 17:54:54 -0500 (Thu, 21 Aug 2008) | 47 lines


(closes issue http://bugs.digium.com/view.php?id=13251)
Reported by: sergee
Tested by: murf



THis is a bold move for a static release fix, but I wouldn't have
made it if I didn't feel confident (at least a *bit* confident)
that it wouldn't mess everyone up.

The reasoning goes something like this:

1. We simply cannot do anything with CDR's at the current point
(in pbx.c, after the __ast_pbx_run loop). It's way too late to
have any affect on the CDRs. The CDR is already posted and gone,
and the remnants have been cleared.

2. I was very much afraid that moving the running of the 'h'
extension down into the bridge code (where it would be now
practical to do it), would result in a lot more calls to the
'h' exten, so I implemented it as another exten under another
name, but found, to my pleasant surprise, that there was a 
1:1 correspondence to the running of the 'h' exten in the
pbx_run loop, and the new spot at the end of the bridge.
So, I ifdef'd out the current 'h' loop, and moved it into
the bridge code. The only difference I can see is the stuff
about the AST_PBX_KEEPALIVE, and hopefully, if this 
is still an important decision point, I can replicate it
if there are complaints. To be perfectly honest,
the KEEPALIVE situation is not totally clear to me,
and how it relates to a post-bridge situation is less
clear. I suspect the users will point out everything
in total clarity if this steps on anyone's toes!

3. I temporarily swap the bridge_cdr into the channel
before running the 'h' exten, which makes it possible
for users to edit the cdr before it goes out the door.
And, of course, with the endbeforehexten config var set,
the users can also get at the billsec/duration vals.
After the h exten finishes, the cdr is swapped back
and processing continues as normal.

Please, all who deal with CDR's, please test this version
of Asterisk, and file bug reports as appropriate!


------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=139347 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-08-21 17:54 svnbot         Note Added: 0091636                          
======================================================================




More information about the asterisk-bugs mailing list