aboutsummaryrefslogtreecommitdiffstats
path: root/main/channel.c
diff options
context:
space:
mode:
authormurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 00:16:25 +0000
committermurf <murf@f38db490-d61c-443f-a65b-d21fe96a405b>2008-07-03 00:16:25 +0000
commit61b6de4e16736df453e61eead1ac1c574305e0f5 (patch)
treef2c79c5941fdf5b648ecb85706407379e93a3dd4 /main/channel.c
parent213226fe9aec511d36531d2677b36785057144c6 (diff)
The CDRfix4/5/6 omnibus cdr fixes.
(closes issue #10927) Reported by: murf Tested by: murf, deeperror (closes issue #12907) Reported by: falves11 Tested by: murf, falves11 (closes issue #11849) Reported by: greyvoip As to 11849, I think these changes fix the core problems brought up in that bug, but perhaps not the more global problems created by the limitations of CDR's themselves not being oriented around transfers. Reopen if necc, but bug reports are not the best medium for enhancement discussions. We need to start a second-generation CDR standardization effort to cover transfers. (closes issue #11093) Reported by: rossbeer Tested by: greyvoip, murf git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@127663 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c41
1 files changed, 8 insertions, 33 deletions
diff --git a/main/channel.c b/main/channel.c
index 05f05d2f8..bdc8491f3 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1434,7 +1434,6 @@ static void free_translation(struct ast_channel *clone)
int ast_hangup(struct ast_channel *chan)
{
int res = 0;
- struct ast_cdr *cdr = NULL;
/* Don't actually hang up a channel that will masquerade as someone else, or
if someone is going to masquerade as us */
@@ -1484,11 +1483,6 @@ int ast_hangup(struct ast_channel *chan)
chan->generator->release(chan, chan->generatordata);
chan->generatordata = NULL;
chan->generator = NULL;
- if (chan->cdr) { /* End the CDR if it hasn't already */
- ast_cdr_end(chan->cdr);
- cdr = chan->cdr;
- chan->cdr = NULL;
- }
if (ast_test_flag(chan, AST_FLAG_BLOCKING)) {
ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
"is blocked by thread %ld in procedure %s! Expect a failure\n",
@@ -1516,10 +1510,13 @@ int ast_hangup(struct ast_channel *chan)
chan->hangupcause,
ast_cause2str(chan->hangupcause)
);
- ast_channel_free(chan);
- if (cdr)
- ast_cdr_detach(cdr);
+ if (chan->cdr && !ast_test_flag(chan->cdr, AST_CDR_FLAG_BRIDGED) && !ast_test_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED) && chan->cdr->disposition != AST_CDR_NULL) {
+ ast_cdr_end(chan->cdr);
+ ast_cdr_detach(chan->cdr);
+ }
+
+ ast_channel_free(chan);
return res;
}
@@ -1547,7 +1544,6 @@ int ast_answer(struct ast_channel *chan)
ast_cdr_answer(chan->cdr);
break;
case AST_STATE_UP:
- ast_cdr_answer(chan->cdr);
break;
default:
break;
@@ -2129,15 +2125,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
} else {
/* Answer the CDR */
ast_setstate(chan, AST_STATE_UP);
- if (!chan->cdr) { /* up till now, this insertion hasn't been done. Therefore,
- to keep from throwing off the basic order of the universe,
- we will try to keep this cdr from getting posted. */
- chan->cdr = ast_cdr_alloc();
- ast_cdr_init(chan->cdr, chan);
- ast_cdr_start(chan->cdr);
- }
-
- ast_cdr_answer(chan->cdr);
+ /* removed a call to ast_cdr_answer(chan->cdr) from here. */
}
}
break;
@@ -2352,9 +2340,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
chan->_softhangup |= AST_SOFTHANGUP_DEV;
if (chan->generator)
ast_deactivate_generator(chan);
- /* End the CDR if appropriate */
- if (chan->cdr)
- ast_cdr_end(chan->cdr);
+ /* We no longer End the CDR here */
}
/* High bit prints debugging */
@@ -2916,15 +2902,6 @@ struct ast_channel *__ast_request_and_dial(const char *type, int format, void *d
}
ast_set_callerid(chan, cid_num, cid_name, cid_num);
-
-
- if (!chan->cdr) { /* up till now, this insertion hasn't been done. Therefore,
- to keep from throwing off the basic order of the universe,
- we will try to keep this cdr from getting posted. */
- chan->cdr = ast_cdr_alloc();
- ast_cdr_init(chan->cdr, chan);
- ast_cdr_start(chan->cdr);
- }
if (ast_call(chan, data, 0)) { /* ast_call failed... */
ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, (char *)data);
} else {
@@ -3678,8 +3655,6 @@ void ast_set_callerid(struct ast_channel *chan, const char *callerid, const char
free(chan->cid.cid_ani);
chan->cid.cid_ani = ast_strdup(ani);
}
- if (chan->cdr)
- ast_cdr_setcid(chan->cdr, chan);
manager_event(EVENT_FLAG_CALL, "Newcallerid",
"Channel: %s\r\n"
"CallerID: %s\r\n"