summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
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"