[asterisk-commits] murf: branch murf/CDRfix4 r122592 - /team/murf/CDRfix4/channels/chan_dahdi.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jun 13 12:08:20 CDT 2008


Author: murf
Date: Fri Jun 13 12:08:19 2008
New Revision: 122592

URL: http://svn.digium.com/view/asterisk?view=rev&rev=122592
Log:
Slide the changes from chan_zap to chan_dahdi

Modified:
    team/murf/CDRfix4/channels/chan_dahdi.c

Modified: team/murf/CDRfix4/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix4/channels/chan_dahdi.c?view=diff&rev=122592&r1=122591&r2=122592
==============================================================================
--- team/murf/CDRfix4/channels/chan_dahdi.c (original)
+++ team/murf/CDRfix4/channels/chan_dahdi.c Fri Jun 13 12:08:19 2008
@@ -3511,18 +3511,6 @@
 		if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_THREEWAY].dfd, DAHDI_TONE_RINGTONE);
 		}
-		if (p->subs[SUB_REAL].owner->cdr) {
-			/* Move CDR from second channel to current one */
-			p->subs[SUB_THREEWAY].owner->cdr =
-				ast_cdr_append(p->subs[SUB_THREEWAY].owner->cdr, p->subs[SUB_REAL].owner->cdr);
-			p->subs[SUB_REAL].owner->cdr = NULL;
-		}
-		if (ast_bridged_channel(p->subs[SUB_REAL].owner)->cdr) {
-			/* Move CDR from second channel's bridge to current one */
-			p->subs[SUB_THREEWAY].owner->cdr =
-				ast_cdr_append(p->subs[SUB_THREEWAY].owner->cdr, ast_bridged_channel(p->subs[SUB_REAL].owner)->cdr);
-			ast_bridged_channel(p->subs[SUB_REAL].owner)->cdr = NULL;
-		}
 		 if (ast_channel_masquerade(p->subs[SUB_THREEWAY].owner, ast_bridged_channel(p->subs[SUB_REAL].owner))) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
 					ast_bridged_channel(p->subs[SUB_REAL].owner)->name, p->subs[SUB_THREEWAY].owner->name);
@@ -3538,18 +3526,6 @@
 		}
 		if (p->subs[SUB_REAL].owner->_state == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_REAL].dfd, DAHDI_TONE_RINGTONE);
-		}
-		if (p->subs[SUB_THREEWAY].owner->cdr) {
-			/* Move CDR from second channel to current one */
-			p->subs[SUB_REAL].owner->cdr = 
-				ast_cdr_append(p->subs[SUB_REAL].owner->cdr, p->subs[SUB_THREEWAY].owner->cdr);
-			p->subs[SUB_THREEWAY].owner->cdr = NULL;
-		}
-		if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)->cdr) {
-			/* Move CDR from second channel's bridge to current one */
-			p->subs[SUB_REAL].owner->cdr = 
-				ast_cdr_append(p->subs[SUB_REAL].owner->cdr, ast_bridged_channel(p->subs[SUB_THREEWAY].owner)->cdr);
-			ast_bridged_channel(p->subs[SUB_THREEWAY].owner)->cdr = NULL;
 		}
 		if (ast_channel_masquerade(p->subs[SUB_REAL].owner, ast_bridged_channel(p->subs[SUB_THREEWAY].owner))) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
@@ -4300,6 +4276,17 @@
 							dahdi_enable_ec(p);
 							ast_hangup(chan);
 						} else {
+ 							struct ast_channel *other = ast_bridged_channel(p->subs[SUB_THREEWAY].owner);
+ 							int way3bridge = 0, cdr3way = 0;
+ 							
+ 							if (!other) {
+ 								other = ast_bridged_channel(p->subs[SUB_REAL].owner);
+ 							} else
+ 								way3bridge = 1;
+ 							
+ 							if (p->subs[SUB_THREEWAY].owner->cdr)
+ 								cdr3way = 1;
+ 							
 							if (option_verbose > 2)	
 								ast_verbose(VERBOSE_PREFIX_3 "Started three way call on channel %d\n", p->channel);
 							/* Start music on hold if appropriate */
@@ -4324,6 +4311,15 @@
 							swap_subs(p, SUB_THREEWAY, SUB_REAL);
 							p->owner = p->subs[SUB_REAL].owner;
 						}
+#ifdef CDR_FIX_NOT_ANYMORE
+						if (p->subs[SUB_THREEWAY].owner->cdr) {
+							struct ast_cdr *x2 = ast_cdr_dup(p->subs[SUB_THREEWAY].owner->cdr);
+							ast_cdr_end(x2);
+							ast_cdr_detach(x2);
+							p->subs[SUB_THREEWAY].owner->cdr->start = ast_tvnow();
+							p->subs[SUB_THREEWAY].owner->cdr->answer = ast_tvnow();
+						}
+#endif
 						/* Drop the last call and stop the conference */
 						if (option_verbose > 2)
 							ast_verbose(VERBOSE_PREFIX_3 "Dropping three-way call on %s\n", p->subs[SUB_THREEWAY].owner->name);
@@ -4335,6 +4331,16 @@
 						if (((ast->pbx) || (ast->_state == AST_STATE_UP)) && 
 						    (p->transfertobusy || (ast->_state != AST_STATE_BUSY))) {
 							int otherindex = SUB_THREEWAY;
+							struct ast_channel *other = ast_bridged_channel(p->subs[SUB_THREEWAY].owner);
+							int way3bridge = 0, cdr3way = 0;
+							
+							if (!other) {
+								other = ast_bridged_channel(p->subs[SUB_REAL].owner);
+							} else
+								way3bridge = 1;
+							
+							if (p->subs[SUB_THREEWAY].owner->cdr)
+								cdr3way = 1;
 
 							if (option_verbose > 2)
 								ast_verbose(VERBOSE_PREFIX_3 "Building conference on call on %s and %s\n", p->subs[SUB_THREEWAY].owner->name, p->subs[SUB_REAL].owner->name);




More information about the asterisk-commits mailing list