diff options
-rw-r--r-- | include/asterisk/cdr.h | 1 | ||||
-rw-r--r-- | main/cdr.c | 12 | ||||
-rw-r--r-- | main/channel.c | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h index 9cd65713a..1f71039eb 100644 --- a/include/asterisk/cdr.h +++ b/include/asterisk/cdr.h @@ -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 */ /*@{ */ diff --git a/main/cdr.c b/main/cdr.c index 65c4e3e01..7011e32d5 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -850,7 +850,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 */ @@ -1037,6 +1037,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); @@ -1088,7 +1096,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; } } } diff --git a/main/channel.c b/main/channel.c index 1502f4b8b..aab7134f7 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3601,6 +3601,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); |