diff --git a/apps/app_dial.c b/apps/app_dial.c index 91e7325f2e..fdf24cc71f 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -696,6 +696,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l 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); @@ -709,6 +710,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l if (option_verbose > 2) 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); @@ -721,6 +723,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l if (option_verbose > 2) 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; @@ -749,6 +752,10 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct dial_l } 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/include/asterisk/cdr.h b/include/asterisk/cdr.h index 152b82e7d6..b61e250145 100644 --- a/include/asterisk/cdr.h +++ b/include/asterisk/cdr.h @@ -30,9 +30,10 @@ #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 */ @@ -174,6 +175,13 @@ void ast_cdr_start(struct ast_cdr *cdr); */ 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