[asterisk-commits] murf: branch murf/CDRfix5 r74255 - /team/murf/CDRfix5/apps/app_meetme.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 9 19:38:54 CDT 2007


Author: murf
Date: Mon Jul  9 19:38:54 2007
New Revision: 74255

URL: http://svn.digium.com/view/asterisk?view=rev&rev=74255
Log:
Added some code to log conference join/ends in the Cdrs. The linkedID will be the conference # for those calls.

Modified:
    team/murf/CDRfix5/apps/app_meetme.c

Modified: team/murf/CDRfix5/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/murf/CDRfix5/apps/app_meetme.c?view=diff&rev=74255&r1=74254&r2=74255
==============================================================================
--- team/murf/CDRfix5/apps/app_meetme.c (original)
+++ team/murf/CDRfix5/apps/app_meetme.c Mon Jul  9 19:38:54 2007
@@ -105,7 +105,8 @@
 };
 
 #define CONF_SIZE  320
-
+void ast_channel_log(char *title, struct ast_channel *chan);
+void ast_cdr_log(char *title, struct ast_cdr *cdr);
 enum {
 	/*! user has admin access on the conference */
 	CONFFLAG_ADMIN = (1 << 0),
@@ -1424,6 +1425,7 @@
 	char __buf[CONF_SIZE + AST_FRIENDLY_OFFSET];
 	char *buf = __buf + AST_FRIENDLY_OFFSET;
 	char *exitkeys = NULL;
+	struct ast_cdr *bridge_cdr;
 
 	if (!(user = ast_calloc(1, sizeof(*user))))
 		return ret;
@@ -1701,6 +1703,30 @@
 		sent_event = 1;
 	}
 
+	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);
+			bridge_cdr = ast_cdr_dup(chan->cdr);
+		} 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->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));
+			ast_cdr_start(bridge_cdr);
+		}
+		ast_cdr_answer(bridge_cdr);
+	}
+	
 	if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) {
 		firstpass = 1;
 		if (!(confflags & CONFFLAG_QUIET))
@@ -2288,6 +2314,33 @@
 	if (dsp)
 		ast_dsp_free(dsp);
 	
+	/* 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);
+		
+		/* update the linked id field, as xfers, etc, might have changed it */
+		ast_copy_string(bridge_cdr->linkedid, conf->confno, sizeof(bridge_cdr->linkedid));
+
+		ast_cdr_end(bridge_cdr);
+
+		ast_cdr_log("Closing CDR attached to CHAN", chan->cdr);
+		if (chan->masqr && chan->masqr->cdr)
+			ast_cdr_log("Closing CDR attached to Masqueraded CHAN", chan->masqr->cdr);
+		if (chan->masqr && chan->masqr->cdr && chan->masqr->cdr->next)
+			ast_cdr_log("Closing NEXT CDR attached to Masqueraded CHAN", chan->masqr->cdr->next);
+		if (chan->masqr && chan->masqr->cdr && chan->masqr->cdr->next && chan->masqr->cdr->next->next)
+			ast_cdr_log("Closing NEXT NEXT CDR attached to Masqueraded CHAN", chan->masqr->cdr->next->next);
+		if (chan->masqr && chan->masqr->cdr && chan->masqr->cdr->next && chan->masqr->cdr->next->next && chan->masqr->cdr->next->next->next)
+			ast_cdr_log("Closing NEXT NEXT NEXT CDR attached to Masqueraded CHAN", chan->masqr->cdr->next->next->next);
+		
+		ast_cdr_detach(bridge_cdr);
+	
+		/* just in case, these channels get bridged again before hangup */
+		ast_cdr_sortof_reset(chan->cdr,0);
+	}
+
+		
 	if (user->user_no) { /* Only cleanup users who really joined! */
 		now = time(NULL);
 		hr = (now - user->jointime) / 3600;




More information about the asterisk-commits mailing list