[Asterisk-cvs] asterisk/channels chan_sip.c, 1.510.2.1, 1.510.2.2 chan_zap.c, 1.344.2.1, 1.344.2.2

russell at lists.digium.com russell at lists.digium.com
Sun Oct 3 16:20:59 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv24330/channels

Modified Files:
      Tag: v1-0
	chan_sip.c chan_zap.c 
Log Message:
Fix CDR for supervised transfer in chan_zap and chan_sip (bug #1595)


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.510.2.1
retrieving revision 1.510.2.2
diff -u -d -r1.510.2.1 -r1.510.2.2
--- chan_sip.c	1 Oct 2004 00:32:47 -0000	1.510.2.1
+++ chan_sip.c	3 Oct 2004 20:22:41 -0000	1.510.2.2
@@ -7001,6 +7001,14 @@
 		ast_moh_stop(p1->owner->bridge);
 		ast_moh_stop(p1->owner);
 		ast_moh_stop(p2->owner);
+		if (p1->owner->cdr) {
+			p2->owner->cdr = ast_cdr_append(p2->owner->cdr, p1->owner->cdr);
+			p1->owner->cdr = NULL;
+		}
+		if (p1->owner->bridge->cdr) {
+			p2->owner->cdr = ast_cdr_append(p2->owner->cdr, p1->owner->bridge->cdr);
+			p1->owner->bridge->cdr = NULL;
+		}
 		if (ast_channel_masquerade(p2->owner, p1->owner->bridge)) {
 			ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", p2->owner->name, p1->owner->bridge->name);
 			return -1;
@@ -7009,6 +7017,14 @@
 		ast_moh_stop(p2->owner->bridge);
 		ast_moh_stop(p2->owner);
 		ast_moh_stop(p1->owner);
+		if (p2->owner->cdr) {
+			p1->owner->cdr = ast_cdr_append(p1->owner->cdr, p2->owner->cdr);
+			p2->owner->cdr = NULL;
+		}
+		if (p2->owner->bridge->cdr) {
+			p1->owner->cdr = ast_cdr_append(p1->owner->cdr, p2->owner->bridge->cdr);
+			p2->owner->bridge->cdr = NULL;
+		}
 		if (ast_channel_masquerade(p1->owner, p2->owner->bridge)) {
 			ast_log(LOG_WARNING, "Failed to masquerade %s into %s\n", p1->owner->name, p2->owner->bridge->name);
 			return -1;

Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.344.2.1
retrieving revision 1.344.2.2
diff -u -d -r1.344.2.1 -r1.344.2.2
--- chan_zap.c	2 Oct 2004 00:12:20 -0000	1.344.2.1
+++ chan_zap.c	3 Oct 2004 20:22:41 -0000	1.344.2.2
@@ -2886,6 +2886,18 @@
 		if (p->subs[SUB_THREEWAY].owner->_state == AST_STATE_RINGING) {
 			ast_indicate(p->subs[SUB_REAL].owner->bridge, AST_CONTROL_RINGING);
 		}
+		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 (p->subs[SUB_REAL].owner->bridge->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, p->subs[SUB_REAL].owner->bridge->cdr);
+			p->subs[SUB_REAL].owner->bridge->cdr = NULL;
+		}
 		if (ast_channel_masquerade(p->subs[SUB_THREEWAY].owner, p->subs[SUB_REAL].owner->bridge)) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
 					p->subs[SUB_REAL].owner->bridge->name, p->subs[SUB_THREEWAY].owner->name);
@@ -2899,6 +2911,18 @@
 			ast_indicate(p->subs[SUB_THREEWAY].owner->bridge, AST_CONTROL_RINGING);
 		}
 		ast_moh_stop(p->subs[SUB_THREEWAY].owner->bridge);
+		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 (p->subs[SUB_THREEWAY].owner->bridge->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, p->subs[SUB_THREEWAY].owner->bridge->cdr);
+			p->subs[SUB_THREEWAY].owner->bridge->cdr = NULL;
+		}
 		if (ast_channel_masquerade(p->subs[SUB_REAL].owner, p->subs[SUB_THREEWAY].owner->bridge)) {
 			ast_log(LOG_WARNING, "Unable to masquerade %s as %s\n",
 					p->subs[SUB_THREEWAY].owner->bridge->name, p->subs[SUB_REAL].owner->name);




More information about the svn-commits mailing list