(closes issue #10755)
authorJason Parker <jparker@digium.com>
Tue, 18 Sep 2007 16:16:36 +0000 (16:16 +0000)
committerJason Parker <jparker@digium.com>
Tue, 18 Sep 2007 16:16:36 +0000 (16:16 +0000)
Reported by: snar
Patches:
      app-queue-cdr-trunk.patch uploaded by snar (license 245)
      queues.conf.patch uploaded by snar (license 245)

Add an updatecdr option to queues.conf, so that if a "member name" is specified,
 the cdr record will be updated with that, rather than the channel.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@82800 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_queue.c
configs/queues.conf.sample

index ee40bf4..d6e1ec6 100644 (file)
@@ -254,6 +254,9 @@ static int montype_default = 0;
 /*! \brief Subscription to device state change events */
 static struct ast_event_sub *device_state_sub;
 
+/*! \brief queues.conf [general] option */
+static int update_cdr = 0;
+
 enum queue_result {
        QUEUE_UNKNOWN = 0,
        QUEUE_TIMEOUT = 1,
@@ -2995,6 +2998,8 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
                }
                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->parent->eventwhencalled)
                        manager_event(EVENT_FLAG_AGENT, "AgentConnect",
                                        "Queue: %s\r\n"
@@ -4101,9 +4106,13 @@ static int reload_queues(int reload)
                        if ((general_val = ast_variable_retrieve(cfg, "general", "autofill")))
                                autofill_default = ast_true(general_val);
                        montype_default = 0;
-                       if ((general_val = ast_variable_retrieve(cfg, "general", "monitor-type")))
+                       if ((general_val = ast_variable_retrieve(cfg, "general", "monitor-type"))) {
                                if (!strcasecmp(general_val, "mixmonitor"))
                                        montype_default = 1;
+                       }
+                       update_cdr = 0;
+                       if ((general_val = ast_variable_retrieve(cfg, "general", "updatecdr")))
+                               update_cdr = ast_true(general_val);
                } else {        /* Define queue */
                        /* Look for an existing one */
                        AST_LIST_TRAVERSE(&queues, q, list) {
index 4915ee0..052ca79 100644 (file)
@@ -47,6 +47,14 @@ autofill = yes
 ;
 monitor-type = MixMonitor
 ;
+; UpdateCDR behavior. 
+;    This option is implemented to mimic chan_agents behavior of populating
+;    CDR dstchannel field of a call with an agent name, which you can set 
+;    at the login time with AddQueueMember membername parameter. 
+; 
+; updatecdr = no
+
+;
 ; Note that a timeout to fail out of a queue may be passed as part of
 ; an application call from extensions.conf:
 ; Queue(queuename|[options]|[optionalurl]|[announceoverride]|[timeout])