[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r323138 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 13 10:27:53 CDT 2011


Author: irroot
Date: Mon Jun 13 10:27:50 2011
New Revision: 323138

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=323138
Log:
Add A CDR record if missing

Modified:
    team/irroot/distrotech-customers-1.8/apps/app_queue.c

Modified: team/irroot/distrotech-customers-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/apps/app_queue.c?view=diff&rev=323138&r1=323137&r2=323138
==============================================================================
--- team/irroot/distrotech-customers-1.8/apps/app_queue.c (original)
+++ team/irroot/distrotech-customers-1.8/apps/app_queue.c Mon Jun 13 10:27:50 2011
@@ -5076,8 +5076,26 @@
 		qe->handled++;
 		ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "CONNECT", "%ld|%s|%ld", (long) time(NULL) - qe->start, peer->uniqueid,
 													(long)(orig - to > 0 ? (orig - to) / 1000 : 0));
-		if (update_cdr && qe->chan->cdr) 
-			ast_copy_string(qe->chan->cdr->dstchannel, member->membername, sizeof(qe->chan->cdr->dstchannel));
+
+		if (update_cdr && qe->chan->cdr) {
+			struct ast_cdr *cdr;
+			struct ast_cdr *newcdr;
+
+			cdr = qe->chan->cdr;
+			while (cdr->next) {
+				cdr = cdr->next;
+			}
+			if ((strcasecmp(cdr->uniqueid, qe->chan->uniqueid)) && (strcasecmp(cdr->linkedid, qe->chan->uniqueid))) {
+				if ((newcdr = ast_cdr_dup(cdr))) {
+					ast_cdr_init(newcdr, qe->chan);
+					ast_cdr_reset(newcdr, 0);
+					cdr->next = newcdr;
+					cdr = cdr->next;
+				}
+			}
+			ast_copy_string(cdr->dstchannel, member->membername, sizeof(cdr->dstchannel));
+		}
+
 		if (qe->parent->eventwhencalled)
 			manager_event(EVENT_FLAG_AGENT, "AgentConnect",
 					"Queue: %s\r\n"




More information about the asterisk-commits mailing list