]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Move where unanswered CDRs are dropped to the CDR core, not everything uses app_dial.
authorJoshua Colp <jcolp@digium.com>
Mon, 10 Mar 2008 14:33:02 +0000 (14:33 +0000)
committerJoshua Colp <jcolp@digium.com>
Mon, 10 Mar 2008 14:33:02 +0000 (14:33 +0000)
(closes issue #11516)
Reported by: ys
Patches:
      branch_1.4_cdr.diff uploaded by ys (license 281)
Tested by: anest, jcapp, dartvader

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

apps/app_dial.c
include/asterisk/cdr.h
main/cdr.c

index 2465bfc1d6b72f511de1a6a21975df79f47c6f2d..2d5bf093828b079b12b857b94e1e8a3c6f6312dd 100644 (file)
@@ -765,25 +765,6 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l
                }
                
        }
-       if (peer && !ast_cdr_log_unanswered()) {
-               /* suppress the CDR's that didn't win */
-               struct dial_localuser *o;
-               for (o = outgoing; o; o = o->next) {
-                       struct ast_channel *c = o->chan;
-                       if (c && c != peer && c->cdr) {
-                               ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);
-                       }
-               }
-       } else if (!peer && !ast_cdr_log_unanswered()) {
-                       /* suppress the CDR's that didn't win */
-               struct dial_localuser *o;
-               for (o = outgoing; o; o = o->next) {
-                       struct ast_channel *c = o->chan;
-                       if (c && c->cdr) {
-                               ast_set_flag(c->cdr, AST_CDR_FLAG_POST_DISABLED);               
-                       }
-               }
-       }
        
        return peer;
 }
index b88234a391db39863d917715a88414862203a5a0..b61e250145aca69c644e0b7a377c25b5ca593893 100644 (file)
@@ -100,7 +100,6 @@ int ast_cdr_setvar(struct ast_cdr *cdr, const char *name, const char *value, int
 int ast_cdr_serialize_variables(struct ast_cdr *cdr, char *buf, size_t size, char delim, char sep, int recur);
 void ast_cdr_free_vars(struct ast_cdr *cdr, int recur);
 int ast_cdr_copy_vars(struct ast_cdr *to_cdr, struct ast_cdr *from_cdr);
-int ast_cdr_log_unanswered(void);
 
 typedef int (*ast_cdrbe)(struct ast_cdr *cdr);
 
index ee0086444ad5b384b73bd9838acc6ab00bc0a039..377ee09aced6e5e9a1b6f35d9ffbfef5ad7200ef 100644 (file)
@@ -103,11 +103,6 @@ AST_MUTEX_DEFINE_STATIC(cdr_pending_lock);
 static ast_cond_t cdr_pending_cond;
 
 
-int ast_cdr_log_unanswered(void)
-{
-       return unanswered;
-}
-
 /*! Register a CDR driver. Each registered CDR driver generates a CDR 
        \return 0 on success, -1 on failure 
 */
@@ -986,6 +981,12 @@ static void post_cdr(struct ast_cdr *cdr)
        struct ast_cdr_beitem *i;
 
        for ( ; cdr ; cdr = cdr->next) {
+               if (!unanswered && cdr->disposition < AST_CDR_ANSWERED && (ast_strlen_zero(cdr->channel) || ast_strlen_zero(cdr->dstchannel))) {
+                       /* For people, who don't want to see unanswered single-channel events */
+                       ast_set_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
+                       continue;
+               }
+
                chan = S_OR(cdr->channel, "<unknown>");
                check_post(cdr);
                if (ast_tvzero(cdr->end))