From: Matthew Nicholson Date: Fri, 29 May 2009 18:53:01 +0000 (+0000) Subject: Use AST_CDR_NOANSWER instead of AST_CDR_NULL as the default CDR disposition. X-Git-Tag: 1.4.26-rc2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa2fd9a4c288a4efda0c516dcdfb20764cdca458;p=thirdparty%2Fasterisk.git 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.4@198068 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/include/asterisk/cdr.h b/include/asterisk/cdr.h index e6742dee05..3d576b712b 100644 --- a/include/asterisk/cdr.h +++ b/include/asterisk/cdr.h @@ -37,6 +37,7 @@ #define AST_CDR_FLAG_ANSLOCKED (1 << 8) #define AST_CDR_FLAG_DONT_TOUCH (1 << 9) #define AST_CDR_FLAG_DIALED (1 << 10) +#define AST_CDR_FLAG_ORIGINATED (1 << 11) /*! Disposition */ #define AST_CDR_NULL 0 diff --git a/main/cdr.c b/main/cdr.c index 853fed949e..cd051003ba 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -862,7 +862,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 */ @@ -1040,6 +1040,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, ""); check_post(cdr); if (option_verbose > 1 && ast_tvzero(cdr->end)) @@ -1089,7 +1097,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 00a3799704..53ad56ad6f 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3063,6 +3063,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); diff --git a/res/res_features.c b/res/res_features.c index 1e98615f56..f5aca846f4 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -1743,7 +1743,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast ast_copy_string(bridge_cdr->lastapp, S_OR(chan->appl, ""), sizeof(bridge_cdr->lastapp)); ast_copy_string(bridge_cdr->lastdata, S_OR(chan->data, ""), sizeof(bridge_cdr->lastdata)); ast_cdr_setcid(bridge_cdr, chan); - bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NULL; + bridge_cdr->disposition = (chan->_state == AST_STATE_UP) ? AST_CDR_ANSWERED : AST_CDR_NOANSWER; bridge_cdr->amaflags = chan->amaflags ? chan->amaflags : ast_default_amaflags; ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode)); /* Destination information */