[asterisk-commits] jpeeler: trunk r235660 - in /trunk: ./ include/asterisk/cdr.h main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Dec 18 16:51:42 CST 2009


Author: jpeeler
Date: Fri Dec 18 16:51:37 2009
New Revision: 235660

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=235660
Log:
Merged revisions 235635 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
  r235635 | jpeeler | 2009-12-18 16:29:51 -0600 (Fri, 18 Dec 2009) | 48 lines
  
  Correct CDR dispositions for BUSY/FAILED
  
  This patch is simple in that it reorders the disposition defines so that the fix
  for issue 12946 works properly (the default CDR disposition was changed to
  AST_CDR_NOANSWER). Also, the AST_CDR_FLAG_ORIGINATED flag was set in ast_call to
  ensure all CDR records are written.
  
  The side effects of CDR changes are scary, so I'm documenting the test cases
  performed to attempt to catch any regressions. The following tests were all
  performed using 1.4 rev 195881 vs head (235571) + patch:
  
  A calls B
  C calls B (busy)
  Hangup C
  Hangup A
  
  (Both SIP and features)
  A calls B
  A blind transfers to C
  Hangup C
  
  (Both SIP and features)
  A calls B
  A attended transfers to C
  Hangup C
  
  A calls B
  A attended transfers to C (SIP)
  C blind transfers to A (features)
  Hangup A
  
  All of the test scenario CDRs matched.
  
  The following tests were performed just with the patch to ensure proper operation
  (with unanswered=yes):
  
  exten =>s,1,Answer
  exten =>s,n,ResetCDR(w)
  exten =>s,n,ResetCDR(w)
  
  exten =>s,1,ResetCDR(w)
  exten =>s,n,ResetCDR(w)
  
  (closes issue #16180)
  Reported by: aatef
  Patches: 
        bug16180.patch uploaded by jpeeler (license 325)
........

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/cdr.h
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/cdr.h?view=diff&rev=235660&r1=235659&r2=235660
==============================================================================
--- trunk/include/asterisk/cdr.h (original)
+++ trunk/include/asterisk/cdr.h Fri Dec 18 16:51:37 2009
@@ -39,15 +39,15 @@
 #define AST_CDR_FLAG_DONT_TOUCH     (1 << 9)
 #define AST_CDR_FLAG_POST_ENABLE    (1 << 10)
 #define AST_CDR_FLAG_DIALED         (1 << 11)
+#define AST_CDR_FLAG_ORIGINATED		(1 << 12)
 /*@} */
-#define AST_CDR_FLAG_ORIGINATED		(1 << 11)
 
 /*! \name CDR Flags - Disposition */
 /*@{ */
-#define AST_CDR_NULL                0
-#define AST_CDR_FAILED				(1 << 0)
-#define AST_CDR_BUSY				(1 << 1)
-#define AST_CDR_NOANSWER			(1 << 2)
+#define AST_CDR_NOANSWER			0
+#define AST_CDR_NULL                (1 << 0)
+#define AST_CDR_FAILED				(1 << 1)
+#define AST_CDR_BUSY				(1 << 2)
 #define AST_CDR_ANSWERED			(1 << 3)
 /*@} */
 

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=235660&r1=235659&r2=235660
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Fri Dec 18 16:51:37 2009
@@ -2141,7 +2141,6 @@
 int ast_hangup(struct ast_channel *chan)
 {
 	int res = 0;
-	struct ast_cdr *cdr = NULL;
 	char extra_str[64]; /* used for cel logging below */
 
 	/* Don't actually hang up a channel that will masquerade as someone else, or
@@ -2205,11 +2204,6 @@
 	snprintf(extra_str, sizeof(extra_str), "%d,%s,%s", chan->hangupcause, chan->hangupsource, S_OR(pbx_builtin_getvar_helper(chan, "DIALSTATUS"), ""));
 	ast_cel_report_event(chan, AST_CEL_HANGUP, NULL, extra_str, NULL);
 
-	if (chan->cdr) {		/* End the CDR if it hasn't already */
-		ast_cdr_end(chan->cdr);
-		cdr = chan->cdr;
-		chan->cdr = NULL;
-	}
 	if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
 		ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
 					"is blocked by thread %ld in procedure %s!  Expect a failure\n",
@@ -4568,8 +4562,10 @@
 	/* Stop if we're a zombie or need a soft hangup */
 	ast_channel_lock(chan);
 	if (!ast_test_flag(chan, AST_FLAG_ZOMBIE) && !ast_check_hangup(chan)) {
-		if (chan->cdr)
+		if (chan->cdr) {
 			ast_set_flag(chan->cdr, AST_CDR_FLAG_DIALED);
+			ast_set_flag(chan->cdr, AST_CDR_FLAG_ORIGINATED);
+		}
 		if (chan->tech->call)
 			res = chan->tech->call(chan, addr, timeout);
 		ast_set_flag(chan, AST_FLAG_OUTGOING);




More information about the asterisk-commits mailing list