[svn-commits] murf: branch murf/CDRfix6 r122614 - in /team/murf/CDRfix6: ./ channels/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Jun 13 12:37:02 CDT 2008


Author: murf
Date: Fri Jun 13 12:37:01 2008
New Revision: 122614

URL: http://svn.digium.com/view/asterisk?view=rev&rev=122614
Log:
Slide the chan_zap changes into chan_dahdi, and turn on automerge

Modified:
    team/murf/CDRfix6/   (props changed)
    team/murf/CDRfix6/channels/chan_dahdi.c

Propchange: team/murf/CDRfix6/
------------------------------------------------------------------------------
    automerge = yes

Modified: team/murf/CDRfix6/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix6/channels/chan_dahdi.c?view=diff&rev=122614&r1=122613&r2=122614
==============================================================================
--- team/murf/CDRfix6/channels/chan_dahdi.c (original)
+++ team/murf/CDRfix6/channels/chan_dahdi.c Fri Jun 13 12:37:01 2008
@@ -4087,18 +4087,6 @@
 		if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_THREEWAY].zfd, 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);
@@ -4114,18 +4102,6 @@
 		}
 		if (p->subs[SUB_REAL].owner->_state == AST_STATE_RING) {
 			tone_zone_play_tone(p->subs[SUB_REAL].zfd, 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",
@@ -4858,7 +4834,19 @@
 							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;
+							
 							ast_verb(3, "Started three way call on channel %d\n", p->channel);
+
 							/* Start music on hold if appropriate */
 							if (ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
 								ast_queue_control_data(p->subs[SUB_THREEWAY].owner, AST_CONTROL_HOLD,
@@ -4879,6 +4867,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 */
 						ast_verb(3, "Dropping three-way call on %s\n", p->subs[SUB_THREEWAY].owner->name);
 						p->subs[SUB_THREEWAY].owner->_softhangup |= AST_SOFTHANGUP_DEV;
@@ -4889,9 +4886,34 @@
 						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;
+							const char *firstlink;
+							
+#ifdef CDR_FIX_NOT_ANYMORE
+							struct ast_cdr *x2;
+#endif
+							
+							if (!other) {
+								other = ast_bridged_channel(p->subs[SUB_REAL].owner);
+							} else
+								way3bridge = 1;
+							
+							if (p->subs[SUB_THREEWAY].owner->cdr)
+								cdr3way = 1;
 
 							ast_verb(3, "Building conference on call on %s and %s\n", p->subs[SUB_THREEWAY].owner->name, p->subs[SUB_REAL].owner->name);
-							/* Put them in the threeway, and flip */
+							
+							/* get the youngest linked id and push it around */
+							if (strcmp(other->uniqueid, p->subs[SUB_REAL].owner->uniqueid) < 0)
+								firstlink = other->uniqueid;
+							else
+								firstlink = p->subs[SUB_REAL].owner->uniqueid;
+							if (strcmp(p->subs[SUB_THREEWAY].owner->uniqueid, firstlink) < 0)
+								firstlink = p->subs[SUB_THREEWAY].owner->uniqueid;
+							if (p->subs[SUB_REAL].owner->_bridge && strcmp(p->subs[SUB_REAL].owner->uniqueid, firstlink) < 0)
+								firstlink = p->subs[SUB_REAL].owner->_bridge->uniqueid;
+							
 							p->subs[SUB_THREEWAY].inthreeway = 1;
 							p->subs[SUB_REAL].inthreeway = 1;
 							if (ast->_state == AST_STATE_UP) {




More information about the svn-commits mailing list