[asterisk-commits] murf: branch group/CDRfix5 r120823 - in /team/group/CDRfix5: channels/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 5 14:27:49 CDT 2008


Author: murf
Date: Thu Jun  5 14:27:49 2008
New Revision: 120823

URL: http://svn.digium.com/view/asterisk?view=rev&rev=120823
Log:
Mostly spacing updates; revert the code to 1.4 for attempt_transfer; at least until I can figure out why I messed it up in the first place.

Modified:
    team/group/CDRfix5/channels/chan_sip.c
    team/group/CDRfix5/main/features.c
    team/group/CDRfix5/main/pbx.c

Modified: team/group/CDRfix5/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/channels/chan_sip.c?view=diff&rev=120823&r1=120822&r2=120823
==============================================================================
--- team/group/CDRfix5/channels/chan_sip.c (original)
+++ team/group/CDRfix5/channels/chan_sip.c Thu Jun  5 14:27:49 2008
@@ -16853,15 +16853,17 @@
 			ast_quiet_chan(peerd);
 
 		/* Fix CDRs so they're attached to the remaining channel */
-		if (peera->cdr && !peerb->cdr) {
+		if (peera->cdr && peerb->cdr)
+			peerb->cdr = ast_cdr_append(peerb->cdr, peera->cdr);
+		else if (peera->cdr) 
 			peerb->cdr = peera->cdr;
-			peera->cdr = NULL;
-		}
-
-		if (peerc->cdr && !peerb->cdr) {
+		peera->cdr = NULL;
+		
+		if (peerb->cdr && peerc->cdr)
+			peerb->cdr = ast_cdr_append(peerb->cdr, peerc->cdr);
+		else if (peerc->cdr) 
 			peerb->cdr = peerc->cdr;
-			peerc->cdr = NULL;
-		}
+		peerc->cdr = NULL;
 	
 		ast_debug(4, "SIP transfer: trying to masquerade %s into %s\n", peerc->name, peerb->name);
 		if (ast_channel_masquerade(peerb, peerc)) {

Modified: team/group/CDRfix5/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/features.c?view=diff&rev=120823&r1=120822&r2=120823
==============================================================================
--- team/group/CDRfix5/main/features.c (original)
+++ team/group/CDRfix5/main/features.c Thu Jun  5 14:27:49 2008
@@ -2121,65 +2121,65 @@
 	
 	set_config_flags(chan, peer, config);
 	config->firstpass = 1;
-
+	
 	/* Answer if need be */
 	if (ast_answer(chan))
 		return -1;
-
-        /* show the two channels and cdrs involved in the bridge for debug & devel purposes */
-        ast_channel_log("Pre-bridge CHAN Channel info", chan);
-        ast_channel_log("Pre-bridge PEER Channel info", peer);
-        ast_cdr_log("CDR attached to CHAN", chan->cdr);
-        ast_cdr_log("CDR attached to PEER", peer->cdr);
-
-        ast_copy_string(orig_channame,chan->name,sizeof(orig_channame));
-        ast_copy_string(orig_peername,peer->name,sizeof(orig_peername));
-
-        /* two channels are being marked as linked here */
-        ast_channel_set_linkgroup(chan,peer);
-
-        if (!chan->cdr || (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED))) {
-
-                if (chan->cdr) {
-                        ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
-                        ast_cdr_update(chan);
-                        bridge_cdr = ast_cdr_dup(chan->cdr);
-                        ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
-                        ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
-                } else {
-                        /* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
-                        bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */
-                        ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel));
-                        ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel));
-                        ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
-                        ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
-                        ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
-                        ast_cdr_setcid(bridge_cdr, chan);
-                        bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
-                        bridge_cdr->amaflags = chan->amaflags ? chan->amaflags :  ast_default_amaflags;
-                        ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode));
-                        /* Destination information */
-                        ast_copy_string(bridge_cdr->dst, chan->exten, sizeof(bridge_cdr->dst));
-                        ast_copy_string(bridge_cdr->dcontext, chan->context, sizeof(bridge_cdr->dcontext));
-                        if (peer->cdr) {
-                                bridge_cdr->start = peer->cdr->start;
-                                ast_copy_string(bridge_cdr->userfield, peer->cdr->userfield, sizeof(bridge_cdr->userfield));
-                        } else {
-                                ast_cdr_start(bridge_cdr);
-                        }
-                }
-                ast_cdr_answer(bridge_cdr);
-                ast_cdr_answer(chan->cdr); /* for the sake of cli status checks */
-                ast_set_flag(chan->cdr, AST_CDR_FLAG_BRIDGED);
-                if (peer->cdr)
-                        ast_set_flag(peer->cdr, AST_CDR_FLAG_BRIDGED);
-        }
-
+	
+	/* show the two channels and cdrs involved in the bridge for debug & devel purposes */
+	ast_channel_log("Pre-bridge CHAN Channel info", chan);
+	ast_channel_log("Pre-bridge PEER Channel info", peer);
+	ast_cdr_log("CDR attached to CHAN", chan->cdr);
+	ast_cdr_log("CDR attached to PEER", peer->cdr);
+	
+	ast_copy_string(orig_channame,chan->name,sizeof(orig_channame));
+	ast_copy_string(orig_peername,peer->name,sizeof(orig_peername));
+	
+	/* two channels are being marked as linked here */
+	ast_channel_set_linkgroup(chan,peer);
+	
+	if (!chan->cdr || (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED))) {
+		
+		if (chan->cdr) {
+			ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
+			ast_cdr_update(chan);
+			bridge_cdr = ast_cdr_dup(chan->cdr);
+			ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
+		} else {
+			/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
+			bridge_cdr = ast_cdr_alloc(); /* this should be really, really rare/impossible? */
+			ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel));
+			ast_copy_string(bridge_cdr->dstchannel, peer->name, sizeof(bridge_cdr->dstchannel));
+			ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
+			ast_copy_string(bridge_cdr->lastapp, chan->appl, sizeof(bridge_cdr->lastapp));
+			ast_copy_string(bridge_cdr->lastdata, chan->data, sizeof(bridge_cdr->lastdata));
+			ast_cdr_setcid(bridge_cdr, chan);
+			bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
+			bridge_cdr->amaflags = chan->amaflags ? chan->amaflags :  ast_default_amaflags;
+			ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode));
+			/* Destination information */
+			ast_copy_string(bridge_cdr->dst, chan->exten, sizeof(bridge_cdr->dst));
+			ast_copy_string(bridge_cdr->dcontext, chan->context, sizeof(bridge_cdr->dcontext));
+			if (peer->cdr) {
+				bridge_cdr->start = peer->cdr->start;
+				ast_copy_string(bridge_cdr->userfield, peer->cdr->userfield, sizeof(bridge_cdr->userfield));
+			} else {
+				ast_cdr_start(bridge_cdr);
+			}
+		}
+		ast_cdr_answer(bridge_cdr);
+		ast_cdr_answer(chan->cdr); /* for the sake of cli status checks */
+		ast_set_flag(chan->cdr, AST_CDR_FLAG_BRIDGED);
+		if (peer->cdr)
+			ast_set_flag(peer->cdr, AST_CDR_FLAG_BRIDGED);
+	}
+	
 	for (;;) {
 		struct ast_channel *other;	/* used later */
-
+		
 		res = ast_channel_bridge(chan, peer, config, &f, &who);
-
+		
 		if (config->feature_timer) {
 			/* Update time limit for next pass */
 			diff = ast_tvdiff_ms(ast_tvnow(), config->start_time);
@@ -2336,29 +2336,29 @@
 			ast_frfree(f);
 
 	}
-        /* obey the NoCDR() wishes. */
-        if (!chan->cdr || (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED))) {
-
-                ast_channel_log("XXXXXXXXXXX  Post-bridge CHAN Channel info XXXXXXXXXXX", chan);
-                ast_channel_log("XXXXXXXXXXX  Post-bridge PEER Channel info XXXXXXXXXXX", peer);
-
-                /* update the linked id field, as xfers, etc, might have changed it */
-                ast_copy_string(bridge_cdr->linkedid,chan->linkedid,sizeof(bridge_cdr->linkedid));
-
-                ast_cdr_end(bridge_cdr);
-
-                ast_cdr_log("Closing CDR attached to CHAN", chan->cdr);
-                ast_cdr_log("Closing CDR attached to PEER", peer->cdr);
-                if (chan->masqr && chan->masqr->cdr)
-                        ast_cdr_log("Closing CDR attached to Masqueraded CHAN", chan->masqr->cdr);
-
-                ast_cdr_detach(bridge_cdr);
-
-                /* just in case, these channels get bridged again before hangup */
-                ast_cdr_sortof_reset(chan->cdr,0);
-                ast_cdr_sortof_reset(peer->cdr,0);
-        }
-        return res;
+	/* obey the NoCDR() wishes. */
+	if (!chan->cdr || (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED))) {
+		
+		ast_channel_log("XXXXXXXXXXX  Post-bridge CHAN Channel info XXXXXXXXXXX", chan);
+		ast_channel_log("XXXXXXXXXXX  Post-bridge PEER Channel info XXXXXXXXXXX", peer);
+		
+		/* update the linked id field, as xfers, etc, might have changed it */
+		ast_copy_string(bridge_cdr->linkedid,chan->linkedid,sizeof(bridge_cdr->linkedid));
+		
+		ast_cdr_end(bridge_cdr);
+		
+		ast_cdr_log("Closing CDR attached to CHAN", chan->cdr);
+		ast_cdr_log("Closing CDR attached to PEER", peer->cdr);
+		if (chan->masqr && chan->masqr->cdr)
+			ast_cdr_log("Closing CDR attached to Masqueraded CHAN", chan->masqr->cdr);
+		
+		ast_cdr_detach(bridge_cdr);
+		
+		/* just in case, these channels get bridged again before hangup */
+		ast_cdr_sortof_reset(chan->cdr,0);
+		ast_cdr_sortof_reset(peer->cdr,0);
+	}
+	return res;
 }
 
 /*! \brief Output parking event to manager */

Modified: team/group/CDRfix5/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/pbx.c?view=diff&rev=120823&r1=120822&r2=120823
==============================================================================
--- team/group/CDRfix5/main/pbx.c (original)
+++ team/group/CDRfix5/main/pbx.c Thu Jun  5 14:27:49 2008
@@ -6870,7 +6870,7 @@
 					/* here we update the status of the call, which sould be busy.
 			  		 * if that fails then we set the status to failed */
 					if (ast_cdr_disposition(chan->cdr, chan->hangupcause))
-		 			ast_cdr_failed(chan->cdr);
+						ast_cdr_failed(chan->cdr);
  	  	  		}
 
 				if (channel) {




More information about the asterisk-commits mailing list