summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2008-07-03 17:16:44 +0000
committerSteve Murphy <murf@digium.com>2008-07-03 17:16:44 +0000
commitbc2cfb3e81cbd452f21dbaf9a131b036209fb639 (patch)
treea77cff63683081423e7cec350273f6142ec986c8 /main/channel.c
parentf99a310219314b3d13d2e78a351f19c038de0f20 (diff)
Merged revisions 127663 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r127663 | murf | 2008-07-02 18:16:25 -0600 (Wed, 02 Jul 2008) | 30 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@127793 65c4cc65-6c06-0410-ace0-fbb531ad65f3
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 240d1699a..cbfe8ffca 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1582,7 +1582,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 */
@@ -1633,11 +1632,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",
@@ -1667,10 +1661,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;
}
@@ -1722,7 +1719,6 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
}
return res;
case AST_STATE_UP:
- ast_cdr_answer(chan->cdr);
break;
default:
break;
@@ -2524,15 +2520,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;
@@ -2755,9 +2743,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
chan->hangupcause = cause;
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 */
@@ -3329,15 +3315,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 {
@@ -4089,8 +4066,6 @@ void ast_set_callerid(struct ast_channel *chan, const char *cid_num, const char
ast_free(chan->cid.cid_ani);
chan->cid.cid_ani = ast_strdup(cid_ani);
}
- if (chan->cdr)
- ast_cdr_setcid(chan->cdr, chan);
manager_event(EVENT_FLAG_CALL, "NewCallerid",
"Channel: %s\r\n"
"CallerIDNum: %s\r\n"