]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
automerge commit
authorAutomerge Script <automerge@asterisk.org>
Fri, 18 May 2007 21:14:50 +0000 (21:14 +0000)
committerAutomerge Script <automerge@asterisk.org>
Fri, 18 May 2007 21:14:50 +0000 (21:14 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2-netsec@65199 65c4cc65-6c06-0410-ace0-fbb531ad65f3

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

index b04b3343506135a87598fb0665d5bad64998e702..074226e0d2c3c74fa9175fe4825927392c2e35a3 100644 (file)
@@ -678,6 +678,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                        if (!f || ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP))) {
                                /* Got hung up */
                                *to=-1;
+                               ast_cdr_noanswer(in->cdr);
                                strcpy(status, "CANCEL");
                                if (f)
                                        ast_frfree(f);
@@ -691,6 +692,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                                if (option_verbose > 3)
                                                        ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
                                                *to=0;
+                                               ast_cdr_noanswer(in->cdr);
                                                *result = f->subclass;
                                                strcpy(status, "CANCEL");
                                                ast_frfree(f);
@@ -703,6 +705,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                                        if (option_verbose > 3)
                                                ast_verbose(VERBOSE_PREFIX_3 "User hit %c to disconnect call.\n", f->subclass);
                                        *to=0;
+                                       ast_cdr_noanswer(in->cdr);
                                        strcpy(status, "CANCEL");
                                        ast_frfree(f);
                                        return NULL;
@@ -727,6 +730,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
                }
                if (!*to && (option_verbose > 2))
                        ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);
+               if (!*to || ast_check_hangup(in)) {
+                       ast_cdr_noanswer(in->cdr);
+               }
+               
        }
 
        return peer;
diff --git a/cdr.c b/cdr.c
index 8f9c4da0afac10ce2afa540959e48fd96da90e69..0646a0af74a12c0bf59505ceeeb08b169c67f074 100644 (file)
--- a/cdr.c
+++ b/cdr.c
@@ -528,6 +528,22 @@ void ast_cdr_failed(struct ast_cdr *cdr)
        }
 }
 
+void ast_cdr_noanswer(struct ast_cdr *cdr)
+{
+       char *chan; 
+
+       while (cdr) {
+               chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+               if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
+                       ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+               if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+                       if (cdr->disposition < AST_CDR_NOANSWER)
+                               cdr->disposition = AST_CDR_NOANSWER;
+               }
+               cdr = cdr->next;
+       }
+}
+
 int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
 {
        int res = 0;
@@ -638,7 +654,7 @@ int ast_cdr_init(struct ast_cdr *cdr, struct ast_channel *c)
                        ast_copy_string(cdr->clid, tmp, sizeof(cdr->clid));
                        ast_copy_string(cdr->src, num ? num : "", sizeof(cdr->src));
 
-                       cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NOANSWER;
+                       cdr->disposition = (c->_state == AST_STATE_UP) ?  AST_CDR_ANSWERED : AST_CDR_NULL;
                        cdr->amaflags = c->amaflags ? c->amaflags :  ast_default_amaflags;
                        ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
                        /* Destination information */
@@ -671,6 +687,8 @@ void ast_cdr_end(struct ast_cdr *cdr)
 char *ast_cdr_disp2str(int disposition)
 {
        switch (disposition) {
+       case AST_CDR_NULL:
+               return "NO ANSWER"; /* by default, for backward compatibility */
        case AST_CDR_NOANSWER:
                return "NO ANSWER";
        case AST_CDR_FAILED:
@@ -862,7 +880,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_NOANSWER;
+                       cdr->disposition = AST_CDR_NULL;
                }
                        
                cdr = cdr->next;
index ae10ac13a3e31d2d1c54a6529ee2c43172769c5f..5817603c249f7cb3846479014d5a5b9ae370cf90 100644 (file)
 #define AST_CDR_FLAG_CHILD                     (1 << 3)
 #define AST_CDR_FLAG_POST_DISABLED             (1 << 4)
 
-#define AST_CDR_NOANSWER                       (1 << 0)
+#define AST_CDR_NULL                0
+#define AST_CDR_FAILED                         (1 << 0)
 #define AST_CDR_BUSY                           (1 << 1)
-#define AST_CDR_FAILED                         (1 << 2)
+#define AST_CDR_NOANSWER                       (1 << 2)
 #define AST_CDR_ANSWERED                       (1 << 3)
 
 /*! AMA Flags */
@@ -169,6 +170,13 @@ extern void ast_cdr_start(struct ast_cdr *cdr);
  */
 extern void ast_cdr_answer(struct ast_cdr *cdr);
 
+/*! A call wasn't answered */
+/*!
+ * \param cdr the cdr you wish to associate with the call
+ * Marks the channel disposition as "NO ANSWER"
+ */
+extern void ast_cdr_noanswer(struct ast_cdr *cdr);
+
 /*! Busy a call */
 /*!
  * \param cdr the cdr you wish to associate with the call