]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 198072 via svnmerge from
authorMatthew Nicholson <mnicholson@digium.com>
Fri, 29 May 2009 19:13:44 +0000 (19:13 +0000)
committerMatthew Nicholson <mnicholson@digium.com>
Fri, 29 May 2009 19:13:44 +0000 (19:13 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

................
  r198072 | mnicholson | 2009-05-29 14:04:24 -0500 (Fri, 29 May 2009) | 21 lines

  Merged revisions 198068 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4

  ........
    r198068 | mnicholson | 2009-05-29 13:53:01 -0500 (Fri, 29 May 2009) | 15 lines

    Use AST_CDR_NOANSWER instead of AST_CDR_NULL as the default CDR disposition.

    This change also involves the addition of an AST_CDR_FLAG_ORIGINATED flag that is used on originated channels to distinguish: them from dialed channels.

    (closes issue #12946)
    Reported by: meral
    Patches:
          null-cdr2.diff uploaded by mnicholson (license 96)
    Tested by: mnicholson, dbrooks

    (closes issue #15122)
    Reported by: sum
    Tested by: sum
  ........
................

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

include/asterisk/cdr.h
main/cdr.c
main/channel.c

index 9d3940c87cd168bd95a97b6ee99b70e4002d901e..0b94fd73cc0b1d1c8315943eec078a74008ee69d 100644 (file)
@@ -40,6 +40,7 @@
 #define AST_CDR_FLAG_POST_ENABLE    (1 << 10)
 #define AST_CDR_FLAG_DIALED         (1 << 11)
 /*@} */
+#define AST_CDR_FLAG_ORIGINATED                (1 << 11)
 
 /*! \name CDR Flags - Disposition */
 /*@{ */
index 8674b02e8388508e89a5b9dd5b810fd8ba6d7625..1d9a3017118d8cd8946c4aaa6a6aed01d20782f5 100644 (file)
@@ -851,7 +851,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
                        ast_copy_string(cdr->channel, c->name, sizeof(cdr->channel));
                        set_one_cid(cdr, c);
 
-                       cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
+                       cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NOANSWER;
                        cdr->amaflags = c->amaflags ? c->amaflags :  ast_default_amaflags;
                        ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
                        /* Destination information */
@@ -1035,6 +1035,14 @@ static void post_cdr(struct ast_cdr *cdr)
                        continue;
                }
 
+               /* don't post CDRs that are for dialed channels unless those
+                * channels were originated from asterisk (pbx_spool, manager,
+                * cli) */
+               if (ast_test_flag(cdr, AST_CDR_FLAG_DIALED) && !ast_test_flag(cdr, AST_CDR_FLAG_ORIGINATED)) {
+                       ast_set_flag(cdr, AST_CDR_FLAG_POST_DISABLED);
+                       continue;
+               }
+
                chan = S_OR(cdr->channel, "<unknown>");
                check_post(cdr);
                ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
@@ -1086,7 +1094,7 @@ void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
                        cdr->billsec = 0;
                        cdr->duration = 0;
                        ast_cdr_start(cdr);
-                       cdr->disposition = AST_CDR_NULL;
+                       cdr->disposition = AST_CDR_NOANSWER;
                }
        }
 }
index 33c8a4ca73e0765268d928aa73e5aba02280e716..15768b659677233a874083989e7dbc13a5bf4f1f 100644 (file)
@@ -3573,6 +3573,7 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, void *d
                        ast_cdr_setaccount(chan, oh->account);  
        }
        ast_set_callerid(chan, cid_num, cid_name, cid_num);
+       ast_set_flag(chan->cdr, AST_CDR_FLAG_ORIGINATED);
 
        if (ast_call(chan, data, 0)) {  /* ast_call failed... */
                ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, (char *)data);