summaryrefslogtreecommitdiff
path: root/apps/app_queue.c
diff options
context:
space:
mode:
authorGregory Nietsky <gregory@distrotech.co.za>2011-09-23 09:35:32 +0000
committerGregory Nietsky <gregory@distrotech.co.za>2011-09-23 09:35:32 +0000
commitb4d8f26ecd123568e1437d1cb51d12c5833c30ca (patch)
tree43123fb1ef72ae2bbb0622aeec8b760e4255ba70 /apps/app_queue.c
parente734bccdcd96cc79a51abeab2ff76a657fdef273 (diff)
Merged revisions 337840 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r337840 | irroot | 2011-09-23 10:39:22 +0200 (Fri, 23 Sep 2011) | 17 lines Merged revisions 337839 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r337839 | irroot | 2011-09-23 10:34:03 +0200 (Fri, 23 Sep 2011) | 11 lines Make sure a CDR is on the stack for call in the Queue. Only let update_cdr act on the last CDR in the stack. In some circumstances [Attended transfer to queue] a CDR record is not inserted for this call where it should. (closes issue ASTERISK-18567) Review: https://reviewboard.asterisk.org/r/1266 ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@337855 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r--apps/app_queue.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 3a72b5f22..7930ca301 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5077,8 +5077,34 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
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 (qe->chan->cdr) {
+ struct ast_cdr *cdr;
+ struct ast_cdr *newcdr;
+
+ /* Only work with the last CDR in the stack*/
+ cdr = qe->chan->cdr;
+ while (cdr->next) {
+ cdr = cdr->next;
+ }
+
+ /* If this CDR is not related to us add new one*/
+ if ((strcasecmp(cdr->uniqueid, qe->chan->uniqueid)) &&
+ (strcasecmp(cdr->linkedid, qe->chan->uniqueid)) &&
+ (newcdr = ast_cdr_dup(cdr))) {
+ ast_cdr_init(newcdr, qe->chan);
+ ast_cdr_reset(newcdr, 0);
+ ast_channel_lock(qe->chan);
+ cdr = ast_cdr_append(cdr, newcdr);
+ cdr = cdr->next;
+ ast_channel_unlock(qe->chan);
+ }
+
+ if (update_cdr) {
+ ast_copy_string(cdr->dstchannel, member->membername, sizeof(cdr->dstchannel));
+ }
+ }
+
if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentConnect",
"Queue: %s\r\n"