[asterisk-commits] murf: branch group/CDRfix5 r74509 - in /team/group/CDRfix5: apps/ main/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jul 10 19:25:16 CDT 2007
Author: murf
Date: Tue Jul 10 19:25:16 2007
New Revision: 74509
URL: http://svn.digium.com/view/asterisk?view=rev&rev=74509
Log:
Queues are covered; they call ast_bridge_call(); Meetmes should generate a CDR per attendee. Stripped most of the CDR routines from the pbx, channel, and followme stuff. Made bridge code do a cdr_update before copying the channel cdr to the bridge cdr. Stripped cdr linked list traversal from the cdr.c routines-- the cdr stack is now gone; ForkCDR will generate a warning and not do anything.
Modified:
team/group/CDRfix5/apps/app_followme.c
team/group/CDRfix5/apps/app_forkcdr.c
team/group/CDRfix5/apps/app_meetme.c
team/group/CDRfix5/main/cdr.c
team/group/CDRfix5/main/channel.c
team/group/CDRfix5/main/pbx.c
team/group/CDRfix5/res/res_features.c
Modified: team/group/CDRfix5/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/apps/app_followme.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/apps/app_followme.c (original)
+++ team/group/CDRfix5/apps/app_followme.c Tue Jul 10 19:25:16 2007
@@ -428,24 +428,6 @@
if (tmpuser && tmpuser->ochan && tmpuser->state >= 0) {
outbound = tmpuser->ochan;
- if (!outbound->cdr) {
- outbound->cdr = ast_cdr_alloc();
- if (outbound->cdr)
- ast_cdr_init(outbound->cdr, outbound);
- }
- if (outbound->cdr) {
- char tmp[256];
-
- snprintf(tmp, sizeof(tmp), "%s/%s", "Local", tmpuser->dialarg);
- ast_cdr_setapp(outbound->cdr, "FollowMe", tmp);
- ast_cdr_update(outbound);
- ast_cdr_start(outbound->cdr);
- ast_cdr_end(outbound->cdr);
- /* If the cause wasn't handled properly */
- if (ast_cdr_disposition(outbound->cdr, outbound->hangupcause))
- ast_cdr_failed(outbound->cdr);
- } else
- ast_log(LOG_WARNING, "Unable to create Call Detail Record\n");
ast_hangup(tmpuser->ochan);
}
@@ -820,28 +802,6 @@
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "couldn't reach at this number.\n");
- if (outbound) {
- if (!outbound->cdr)
- outbound->cdr = ast_cdr_alloc();
- if (outbound->cdr) {
- char tmp[256];
-
- ast_cdr_init(outbound->cdr, outbound);
- snprintf(tmp, sizeof(tmp), "%s/%s", "Local", dialarg);
- ast_cdr_setapp(outbound->cdr, "FollowMe", tmp);
- ast_cdr_update(outbound);
- ast_cdr_start(outbound->cdr);
- ast_cdr_end(outbound->cdr);
- /* If the cause wasn't handled properly */
- if (ast_cdr_disposition(outbound->cdr,outbound->hangupcause))
- ast_cdr_failed(outbound->cdr);
- } else {
- ast_log(LOG_ERROR, "Unable to create Call Detail Record\n");
- ast_hangup(outbound);
- outbound = NULL;
- }
- }
-
}
} else
ast_log(LOG_WARNING, "Unable to allocate a channel for Local/%s cause: %s\n", dialarg, ast_cause2str(dg));
Modified: team/group/CDRfix5/apps/app_forkcdr.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/apps/app_forkcdr.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/apps/app_forkcdr.c (original)
+++ team/group/CDRfix5/apps/app_forkcdr.c Tue Jul 10 19:25:16 2007
@@ -51,29 +51,6 @@
"If the option 'v' is passed all cdr variables will be passed along also.\n";
-static void ast_cdr_fork(struct ast_channel *chan)
-{
- struct ast_cdr *cdr;
- struct ast_cdr *newcdr;
- struct ast_flags flags = { AST_CDR_FLAG_KEEP_VARS };
-
- cdr = chan->cdr;
-
- while (cdr->next)
- cdr = cdr->next;
-
- if (!(newcdr = ast_cdr_dup(cdr)))
- return;
-
- ast_cdr_append(cdr, newcdr);
- ast_cdr_reset(newcdr, &flags);
-
- if (!ast_test_flag(cdr, AST_CDR_FLAG_KEEP_VARS))
- ast_cdr_free_vars(cdr, 0);
-
- ast_set_flag(cdr, AST_CDR_FLAG_CHILD | AST_CDR_FLAG_LOCKED);
-}
-
static int forkcdr_exec(struct ast_channel *chan, void *data)
{
int res = 0;
@@ -91,7 +68,6 @@
ast_log(LOG_ERROR,"ForkCDR is obsolesced. It will probably not yield correct results any more. Use CDRstart(), CDRanswer(), and CDRclose() functions instead!\n");
- ast_cdr_fork(chan);
ast_module_user_remove(u);
return res;
Modified: team/group/CDRfix5/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/apps/app_meetme.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/apps/app_meetme.c (original)
+++ team/group/CDRfix5/apps/app_meetme.c Tue Jul 10 19:25:16 2007
@@ -1707,6 +1707,7 @@
if (chan->cdr) {
ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
+ ast_cdr_update(chan);
bridge_cdr = ast_cdr_dup(chan->cdr);
} else {
/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
Modified: team/group/CDRfix5/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/cdr.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/main/cdr.c (original)
+++ team/group/CDRfix5/main/cdr.c Tue Jul 10 19:25:16 2007
@@ -186,16 +186,15 @@
static const char *ast_cdr_getvar_internal(struct ast_cdr *cdr, const char *name, int recur)
{
+ struct ast_var_t *variables;
+ struct varshead *headp = &cdr->varshead;
+
if (ast_strlen_zero(name))
return NULL;
- for (; cdr; cdr = recur ? cdr->next : NULL) {
- struct ast_var_t *variables;
- struct varshead *headp = &cdr->varshead;
- AST_LIST_TRAVERSE(headp, variables, entries) {
- if (!strcasecmp(name, ast_var_name(variables)))
- return ast_var_value(variables);
- }
+ AST_LIST_TRAVERSE(headp, variables, entries) {
+ if (!strcasecmp(name, ast_var_name(variables)))
+ return ast_var_value(variables);
}
return NULL;
@@ -313,24 +312,22 @@
return -1;
}
- for (; cdr; cdr = recur ? cdr->next : NULL) {
- headp = &cdr->varshead;
- AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
- if (!strcasecmp(ast_var_name(newvariable), name)) {
- /* there is already such a variable, delete it */
- AST_LIST_REMOVE_CURRENT(headp, entries);
- ast_var_delete(newvariable);
- break;
- }
- }
- AST_LIST_TRAVERSE_SAFE_END;
-
- if (value) {
- newvariable = ast_var_assign(name, value);
- AST_LIST_INSERT_HEAD(headp, newvariable, entries);
- }
- }
-
+ headp = &cdr->varshead;
+ AST_LIST_TRAVERSE_SAFE_BEGIN(headp, newvariable, entries) {
+ if (!strcasecmp(ast_var_name(newvariable), name)) {
+ /* there is already such a variable, delete it */
+ AST_LIST_REMOVE_CURRENT(headp, entries);
+ ast_var_delete(newvariable);
+ break;
+ }
+ }
+ AST_LIST_TRAVERSE_SAFE_END;
+
+ if (value) {
+ newvariable = ast_var_assign(name, value);
+ AST_LIST_INSERT_HEAD(headp, newvariable, entries);
+ }
+
return 0;
}
@@ -371,36 +368,34 @@
(*buf)->used = 0;
(*buf)->str[0] = '\0';
- for (; cdr; cdr = recur ? cdr->next : NULL) {
- if (++x > 1)
- ast_str_append(buf, 0, "\n");
-
- AST_LIST_TRAVERSE(&cdr->varshead, variables, entries) {
- if (variables &&
- (var = ast_var_name(variables)) && (val = ast_var_value(variables)) &&
- !ast_strlen_zero(var) && !ast_strlen_zero(val)) {
- if (ast_str_append(buf, 0, "level %d: %s%c%s%c", x, var, delim, val, sep) < 0) {
- ast_log(LOG_ERROR, "Data Buffer Size Exceeded!\n");
- break;
- } else
- total++;
- } else
- break;
- }
-
- for (i = 0; cdr_readonly_vars[i]; i++) {
- ast_cdr_getvar(cdr, cdr_readonly_vars[i], &tmp, workspace, sizeof(workspace), 0, 0);
- if (!tmp)
- continue;
-
- if (ast_str_append(buf, 0, "level %d: %s%c%s%c", x, cdr_readonly_vars[i], delim, tmp, sep) < 0) {
+ if (++x > 1)
+ ast_str_append(buf, 0, "\n");
+
+ AST_LIST_TRAVERSE(&cdr->varshead, variables, entries) {
+ if (variables &&
+ (var = ast_var_name(variables)) && (val = ast_var_value(variables)) &&
+ !ast_strlen_zero(var) && !ast_strlen_zero(val)) {
+ if (ast_str_append(buf, 0, "level %d: %s%c%s%c", x, var, delim, val, sep) < 0) {
ast_log(LOG_ERROR, "Data Buffer Size Exceeded!\n");
break;
} else
total++;
- }
- }
-
+ } else
+ break;
+ }
+
+ for (i = 0; cdr_readonly_vars[i]; i++) {
+ ast_cdr_getvar(cdr, cdr_readonly_vars[i], &tmp, workspace, sizeof(workspace), 0, 0);
+ if (!tmp)
+ continue;
+
+ if (ast_str_append(buf, 0, "level %d: %s%c%s%c", x, cdr_readonly_vars[i], delim, tmp, sep) < 0) {
+ ast_log(LOG_ERROR, "Data Buffer Size Exceeded!\n");
+ break;
+ } else
+ total++;
+ }
+
return total;
}
@@ -409,12 +404,10 @@
{
/* clear variables */
- for (; cdr; cdr = recur ? cdr->next : NULL) {
- struct ast_var_t *vardata;
- struct varshead *headp = &cdr->varshead;
- while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
- ast_var_delete(vardata);
- }
+ struct ast_var_t *vardata;
+ struct varshead *headp = &cdr->varshead;
+ while ((vardata = AST_LIST_REMOVE_HEAD(headp, entries)))
+ ast_var_delete(vardata);
}
/*! \brief print a warning if cdr already posted */
@@ -429,32 +422,23 @@
void ast_cdr_free(struct ast_cdr *cdr)
{
- while (cdr) {
- struct ast_cdr *next = cdr->next;
- char *chan = S_OR(cdr->channel, "<unknown>");
- if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED) && !ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
- ast_log(LOG_NOTICE, "CDR on channel '%s' not posted\n", chan);
- if (ast_tvzero(cdr->end))
- ast_log(LOG_NOTICE, "CDR on channel '%s' lacks end\n", chan);
- if (ast_tvzero(cdr->start))
- ast_log(LOG_NOTICE, "CDR on channel '%s' lacks start\n", chan);
-
- ast_cdr_free_vars(cdr, 0);
- ast_free(cdr);
- cdr = next;
- }
+ char *chan = S_OR(cdr->channel, "<unknown>");
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_POSTED) && !ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
+ ast_log(LOG_NOTICE, "CDR on channel '%s' not posted\n", chan);
+ if (ast_tvzero(cdr->end))
+ ast_log(LOG_NOTICE, "CDR on channel '%s' lacks end\n", chan);
+ if (ast_tvzero(cdr->start))
+ ast_log(LOG_NOTICE, "CDR on channel '%s' lacks start\n", chan);
+
+ ast_cdr_free_vars(cdr, 0);
+ ast_free(cdr);
}
/*! \brief the same as a cdr_free call, only with no checks; just get rid of it */
void ast_cdr_discard(struct ast_cdr *cdr)
{
- while (cdr) {
- struct ast_cdr *next = cdr->next;
-
- ast_cdr_free_vars(cdr, 0);
- ast_free(cdr);
- cdr = next;
- }
+ ast_cdr_free_vars(cdr, 0);
+ ast_free(cdr);
}
struct ast_cdr *ast_cdr_alloc(void)
@@ -684,113 +668,96 @@
{
char *chan;
- for (; cdr; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- chan = S_OR(cdr->channel, "<unknown>");
- check_post(cdr);
- cdr->start = ast_tvnow();
- }
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ chan = S_OR(cdr->channel, "<unknown>");
+ check_post(cdr);
+ cdr->start = ast_tvnow();
}
}
void ast_cdr_answer(struct ast_cdr *cdr)
{
- for (; cdr; cdr = cdr->next) {
+ check_post(cdr);
+ if (cdr->disposition < AST_CDR_ANSWERED)
+ cdr->disposition = AST_CDR_ANSWERED;
+ if (ast_tvzero(cdr->answer))
+ cdr->answer = ast_tvnow();
+}
+
+void ast_cdr_busy(struct ast_cdr *cdr)
+{
+
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
check_post(cdr);
- if (cdr->disposition < AST_CDR_ANSWERED)
- cdr->disposition = AST_CDR_ANSWERED;
- if (ast_tvzero(cdr->answer))
- cdr->answer = ast_tvnow();
- }
-}
-
-void ast_cdr_busy(struct ast_cdr *cdr)
-{
-
- for (; cdr; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- check_post(cdr);
- if (cdr->disposition < AST_CDR_BUSY)
- cdr->disposition = AST_CDR_BUSY;
- }
+ if (cdr->disposition < AST_CDR_BUSY)
+ cdr->disposition = AST_CDR_BUSY;
}
}
void ast_cdr_failed(struct ast_cdr *cdr)
{
- for (; cdr; cdr = cdr->next) {
+ check_post(cdr);
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ if (cdr->disposition < AST_CDR_FAILED)
+ cdr->disposition = AST_CDR_FAILED;
+ }
+}
+
+void ast_cdr_noanswer(struct ast_cdr *cdr)
+{
+ char *chan;
+
+ chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
+ if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
+ ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ if (cdr->disposition < AST_CDR_NOANSWER)
+ cdr->disposition = AST_CDR_NOANSWER;
+ }
+}
+
+int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
+{
+ int res = 0;
+
+ switch (cause) {
+ case AST_CAUSE_BUSY:
+ ast_cdr_busy(cdr);
+ break;
+ case AST_CAUSE_FAILURE:
+ ast_cdr_failed(cdr);
+ break;
+ case AST_CAUSE_NORMAL:
+ break;
+ case AST_CAUSE_NOTDEFINED:
+ res = -1;
+ break;
+ default:
+ res = -1;
+ ast_log(LOG_WARNING, "Cause not handled\n");
+ }
+ return res;
+}
+
+void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
+{
+ check_post(cdr);
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+ ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
+}
+
+void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
+{
+
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
check_post(cdr);
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- if (cdr->disposition < AST_CDR_FAILED)
- cdr->disposition = AST_CDR_FAILED;
- }
- }
-}
-
-void ast_cdr_noanswer(struct ast_cdr *cdr)
-{
- char *chan;
-
- while (cdr) {
- chan = !ast_strlen_zero(cdr->channel) ? cdr->channel : "<unknown>";
- if (ast_test_flag(cdr, AST_CDR_FLAG_POSTED))
- ast_log(LOG_WARNING, "CDR on channel '%s' already posted\n", chan);
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- if (cdr->disposition < AST_CDR_NOANSWER)
- cdr->disposition = AST_CDR_NOANSWER;
- }
- cdr = cdr->next;
- }
-}
-
-int ast_cdr_disposition(struct ast_cdr *cdr, int cause)
-{
- int res = 0;
-
- for (; cdr; cdr = cdr->next) {
- switch (cause) {
- case AST_CAUSE_BUSY:
- ast_cdr_busy(cdr);
- break;
- case AST_CAUSE_FAILURE:
- ast_cdr_failed(cdr);
- break;
- case AST_CAUSE_NORMAL:
- break;
- case AST_CAUSE_NOTDEFINED:
- res = -1;
- break;
- default:
- res = -1;
- ast_log(LOG_WARNING, "Cause not handled\n");
- }
- }
- return res;
-}
-
-void ast_cdr_setdestchan(struct ast_cdr *cdr, const char *chann)
-{
- for (; cdr; cdr = cdr->next) {
- check_post(cdr);
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
- ast_copy_string(cdr->dstchannel, chann, sizeof(cdr->dstchannel));
- }
-}
-
-void ast_cdr_setapp(struct ast_cdr *cdr, char *app, char *data)
-{
-
- for (; cdr; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- check_post(cdr);
- if (!app)
- app = "";
- ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
- if (!data)
- data = "";
- ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
- }
+ if (!app)
+ app = "";
+ ast_copy_string(cdr->lastapp, app, sizeof(cdr->lastapp));
+ if (!data)
+ data = "";
+ ast_copy_string(cdr->lastdata, data, sizeof(cdr->lastdata));
}
}
@@ -816,10 +783,8 @@
}
int ast_cdr_setcid(struct ast_cdr *cdr, struct ast_channel *c)
{
- for (; cdr; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
- set_one_cid(cdr, c);
- }
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+ set_one_cid(cdr, c);
return 0;
}
@@ -827,42 +792,38 @@
{
char *chan;
- for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- chan = S_OR(cdr->channel, "<unknown>");
- if (!ast_strlen_zero(cdr->channel))
- ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan);
- 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->amaflags = c->amaflags ? c->amaflags : ast_default_amaflags;
- ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
- /* Destination information */
- ast_copy_string(cdr->dst, S_OR(c->macroexten,c->exten), sizeof(cdr->dst));
- ast_copy_string(cdr->dcontext, S_OR(c->macrocontext,c->context), sizeof(cdr->dcontext));
- /* Unique call identifier */
- ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
- /* Linked call identifier */
- ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
- }
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ chan = S_OR(cdr->channel, "<unknown>");
+ if (!ast_strlen_zero(cdr->channel))
+ ast_log(LOG_WARNING, "CDR already initialized on '%s'\n", chan);
+ 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->amaflags = c->amaflags ? c->amaflags : ast_default_amaflags;
+ ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
+ /* Destination information */
+ ast_copy_string(cdr->dst, S_OR(c->macroexten,c->exten), sizeof(cdr->dst));
+ ast_copy_string(cdr->dcontext, S_OR(c->macrocontext,c->context), sizeof(cdr->dcontext));
+ /* Unique call identifier */
+ ast_copy_string(cdr->uniqueid, c->uniqueid, sizeof(cdr->uniqueid));
+ /* Linked call identifier */
+ ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
}
return 0;
}
void ast_cdr_end(struct ast_cdr *cdr)
{
- for ( ; cdr ; cdr = cdr->next) {
- check_post(cdr);
- if (ast_tvzero(cdr->end))
- cdr->end = ast_tvnow();
- if (ast_tvzero(cdr->start)) {
- ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", S_OR(cdr->channel, "<unknown>"));
- cdr->disposition = AST_CDR_FAILED;
- } else
- cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
- cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec - cdr->answer.tv_sec;
- }
+ check_post(cdr);
+ if (ast_tvzero(cdr->end))
+ cdr->end = ast_tvnow();
+ if (ast_tvzero(cdr->start)) {
+ ast_log(LOG_WARNING, "CDR on channel '%s' has not started\n", S_OR(cdr->channel, "<unknown>"));
+ cdr->disposition = AST_CDR_FAILED;
+ } else
+ cdr->duration = cdr->end.tv_sec - cdr->start.tv_sec;
+ cdr->billsec = ast_tvzero(cdr->answer) ? 0 : cdr->end.tv_sec - cdr->answer.tv_sec;
}
char *ast_cdr_disp2str(int disposition)
@@ -901,10 +862,8 @@
struct ast_cdr *cdr = chan->cdr;
ast_string_field_set(chan, accountcode, account);
- for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
- }
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
}
return 0;
}
@@ -914,10 +873,8 @@
struct ast_cdr *cdr;
int newflag = ast_cdr_amaflags2int(flag);
if (newflag) {
- for (cdr = chan->cdr; cdr; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- cdr->amaflags = newflag;
- }
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ cdr->amaflags = newflag;
}
}
@@ -928,10 +885,7 @@
{
struct ast_cdr *cdr = chan->cdr;
- for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
- ast_copy_string(cdr->userfield, userfield, sizeof(cdr->userfield));
- }
+ ast_copy_string(cdr->userfield, userfield, sizeof(cdr->userfield));
return 0;
}
@@ -939,13 +893,9 @@
int ast_cdr_appenduserfield(struct ast_channel *chan, const char *userfield)
{
struct ast_cdr *cdr = chan->cdr;
-
- for ( ; cdr ; cdr = cdr->next) {
- int len = strlen(cdr->userfield);
-
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
- ast_copy_string(cdr->userfield + len, userfield, sizeof(cdr->userfield) - len);
- }
+ int len = strlen(cdr->userfield);
+
+ ast_copy_string(cdr->userfield + len, userfield, sizeof(cdr->userfield) - len);
return 0;
}
@@ -954,19 +904,15 @@
{
struct ast_cdr *cdr = c->cdr;
- for ( ; cdr ; cdr = cdr->next) {
- if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- set_one_cid(cdr, c);
-
- /* Copy account code et-al */
- ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
- ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
- /* Destination information */ /* XXX privilege macro* ? */
- ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));
- ast_copy_string(cdr->dcontext, S_OR(c->macrocontext, c->context), sizeof(cdr->dcontext));
- }
- }
-
+ set_one_cid(cdr, c);
+
+ /* Copy account code et-al */
+ ast_copy_string(cdr->accountcode, c->accountcode, sizeof(cdr->accountcode));
+ ast_copy_string(cdr->linkedid, c->linkedid, sizeof(cdr->linkedid));
+ /* Destination information */ /* XXX privilege macro* ? */
+ ast_copy_string(cdr->dst, S_OR(c->macroexten, c->exten), sizeof(cdr->dst));
+ ast_copy_string(cdr->dcontext, S_OR(c->macrocontext, c->context), sizeof(cdr->dcontext));
+
return 0;
}
@@ -988,22 +934,20 @@
char *chan;
struct ast_cdr_beitem *i;
- for ( ; cdr ; cdr = cdr->next) {
- chan = S_OR(cdr->channel, "<unknown>");
- check_post(cdr);
- if (ast_tvzero(cdr->end))
- ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
- if (ast_tvzero(cdr->start))
- ast_log(LOG_WARNING, "CDR on channel '%s' lacks start\n", chan);
- ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
- if (ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
- continue;
- AST_RWLIST_RDLOCK(&be_list);
- AST_RWLIST_TRAVERSE(&be_list, i, list) {
- i->be(cdr);
- }
- AST_RWLIST_UNLOCK(&be_list);
- }
+ chan = S_OR(cdr->channel, "<unknown>");
+ check_post(cdr);
+ if (ast_tvzero(cdr->end))
+ ast_log(LOG_WARNING, "CDR on channel '%s' lacks end\n", chan);
+ if (ast_tvzero(cdr->start))
+ ast_log(LOG_WARNING, "CDR on channel '%s' lacks start\n", chan);
+ ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
+ if (ast_test_flag(cdr, AST_CDR_FLAG_POST_DISABLED))
+ return;
+ AST_RWLIST_RDLOCK(&be_list);
+ AST_RWLIST_TRAVERSE(&be_list, i, list) {
+ i->be(cdr);
+ }
+ AST_RWLIST_UNLOCK(&be_list);
}
void ast_cdr_reset(struct ast_cdr *cdr, struct ast_flags *_flags)
@@ -1014,32 +958,30 @@
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
- for ( ; cdr ; cdr = cdr->next) {
- /* Detach if post is requested */
- if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
- if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
- ast_cdr_end(cdr);
- if ((dup = ast_cdr_dup(cdr))) {
- ast_cdr_detach(dup);
- }
- ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
+ /* Detach if post is requested */
+ if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+ if (ast_test_flag(&flags, AST_CDR_FLAG_POSTED)) {
+ ast_cdr_end(cdr);
+ if ((dup = ast_cdr_dup(cdr))) {
+ ast_cdr_detach(dup);
}
-
- /* clear variables */
- if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
- ast_cdr_free_vars(cdr, 0);
- }
-
- /* Reset to initial state */
- ast_clear_flag(cdr, AST_FLAGS_ALL);
- memset(&cdr->start, 0, sizeof(cdr->start));
- memset(&cdr->end, 0, sizeof(cdr->end));
- memset(&cdr->answer, 0, sizeof(cdr->answer));
- cdr->billsec = 0;
- cdr->duration = 0;
- ast_cdr_start(cdr);
- cdr->disposition = AST_CDR_NULL;
- }
+ ast_set_flag(cdr, AST_CDR_FLAG_POSTED);
+ }
+
+ /* clear variables */
+ if (!ast_test_flag(&flags, AST_CDR_FLAG_KEEP_VARS)) {
+ ast_cdr_free_vars(cdr, 0);
+ }
+
+ /* Reset to initial state */
+ ast_clear_flag(cdr, AST_FLAGS_ALL);
+ memset(&cdr->start, 0, sizeof(cdr->start));
+ memset(&cdr->end, 0, sizeof(cdr->end));
+ memset(&cdr->answer, 0, sizeof(cdr->answer));
+ cdr->billsec = 0;
+ cdr->duration = 0;
+ ast_cdr_start(cdr);
+ cdr->disposition = AST_CDR_NULL;
}
}
@@ -1050,20 +992,18 @@
if (_flags)
ast_copy_flags(&flags, _flags, AST_FLAGS_ALL);
- for ( ; cdr ; cdr = cdr->next) {
- /* Detach if post is requested */
- if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
-
- /* Reset to initial state */
- ast_clear_flag(cdr, AST_FLAGS_ALL);
- memset(&cdr->start, 0, sizeof(cdr->start));
- memset(&cdr->end, 0, sizeof(cdr->end));
- memset(&cdr->answer, 0, sizeof(cdr->answer));
- cdr->billsec = 0;
- cdr->duration = 0;
- ast_cdr_start(cdr);
- cdr->disposition = AST_CDR_NULL;
- }
+ /* Detach if post is requested */
+ if (ast_test_flag(&flags, AST_CDR_FLAG_LOCKED) || !ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
+
+ /* Reset to initial state */
+ ast_clear_flag(cdr, AST_FLAGS_ALL);
+ memset(&cdr->start, 0, sizeof(cdr->start));
+ memset(&cdr->end, 0, sizeof(cdr->end));
+ memset(&cdr->answer, 0, sizeof(cdr->answer));
+ cdr->billsec = 0;
+ cdr->duration = 0;
+ ast_cdr_start(cdr);
+ cdr->disposition = AST_CDR_NULL;
}
}
Modified: team/group/CDRfix5/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/channel.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/main/channel.c (original)
+++ team/group/CDRfix5/main/channel.c Tue Jul 10 19:25:16 2007
@@ -1603,7 +1603,6 @@
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 */
@@ -1649,13 +1648,6 @@
chan->generator->release(chan, chan->generatordata);
chan->generatordata = NULL;
chan->generator = NULL;
-#ifdef OLDCDR
- if (chan->cdr) { /* End the CDR if it hasn't already */
- ast_cdr_end(chan->cdr);
- cdr = chan->cdr;
- chan->cdr = NULL;
- }
-#endif
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",
@@ -1683,9 +1675,6 @@
);
ast_channel_free(chan);
- if (cdr)
- ast_cdr_detach(cdr);
-
return res;
}
@@ -1713,14 +1702,12 @@
if (chan->tech->answer)
res = chan->tech->answer(chan);
ast_setstate(chan, AST_STATE_UP);
- ast_cdr_answer(chan->cdr);
ast_channel_unlock(chan);
if (delay)
ast_safe_sleep(chan, delay);
return res;
break;
case AST_STATE_UP:
- ast_cdr_answer(chan->cdr);
break;
default:
break;
@@ -2249,15 +2236,6 @@
} 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);
}
}
break;
@@ -2429,9 +2407,6 @@
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);
}
/* High bit prints debugging */
@@ -2984,13 +2959,6 @@
- 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 {
@@ -3051,19 +3019,6 @@
*outstate = AST_CONTROL_ANSWER;
if (res <= 0) {
- if (!chan->cdr && (chan->cdr = ast_cdr_alloc()))
- ast_cdr_init(chan->cdr, chan);
- if (chan->cdr) {
- char tmp[256];
- snprintf(tmp, sizeof(tmp), "%s/%s", type, (char *)data);
- ast_cdr_setapp(chan->cdr,"Dial",tmp);
- ast_cdr_update(chan);
- ast_cdr_start(chan->cdr);
- ast_cdr_end(chan->cdr);
- /* If the cause wasn't handled properly */
- if (ast_cdr_disposition(chan->cdr,chan->hangupcause))
- ast_cdr_failed(chan->cdr);
- }
ast_hangup(chan);
chan = NULL;
}
@@ -3754,8 +3709,6 @@
ast_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"
"CallerIDNum: %s\r\n"
Modified: team/group/CDRfix5/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/main/pbx.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/main/pbx.c (original)
+++ team/group/CDRfix5/main/pbx.c Tue Jul 10 19:25:16 2007
@@ -548,9 +548,6 @@
const char *saved_c_appl;
const char *saved_c_data;
-
- if (c->cdr && !ast_check_hangup(c) && strcmp(c->exten,"h") != 0)
- ast_cdr_setapp(c->cdr, app->name, data);
/* save channel values */
saved_c_appl= c->appl;
@@ -2331,17 +2328,6 @@
}
if (!(c->pbx = ast_calloc(1, sizeof(*c->pbx))))
return -1;
- if (c->amaflags) {
- if (!c->cdr) {
- c->cdr = ast_cdr_alloc();
- if (!c->cdr) {
- ast_log(LOG_WARNING, "Unable to create Call Detail Record\n");
- ast_free(c->pbx);
- return -1;
- }
- ast_cdr_init(c->cdr, c);
- }
- }
/* Set reasonable defaults */
c->pbx->rtimeout = 10;
c->pbx->dtimeout = 5;
@@ -2366,8 +2352,6 @@
ast_copy_string(c->context, "default", sizeof(c->context));
}
}
- if (c->cdr && ast_tvzero(c->cdr->start))
- ast_cdr_start(c->cdr);
for (;;) {
char dst_exten[256]; /* buffer to accumulate digits */
int pos = 0; /* XXX should check bounds */
@@ -2400,8 +2384,6 @@
} else if (c->_softhangup == AST_SOFTHANGUP_TIMEOUT) {
/* atimeout, nothing bad */
} else {
- if (c->cdr)
- ast_cdr_update(c);
error = 1;
break;
}
@@ -2495,18 +2477,11 @@
}
}
}
- if (c->cdr) {
- if (option_verbose > 2)
- ast_verbose(VERBOSE_PREFIX_2 "CDR updated on %s\n",c->name);
- ast_cdr_update(c);
- }
}
}
if (!found && !error)
ast_log(LOG_WARNING, "Don't know what to do with '%s'\n", c->name);
if ((res != AST_PBX_KEEPALIVE) && ast_exists_extension(c, c->context, "h", 1, c->cid.cid_num)) {
- if (c->cdr && ast_opt_end_cdr_before_h_exten)
- ast_cdr_end(c->cdr);
set_ext_pri(c, "h", 1);
while (ast_exists_extension(c, c->context, c->exten, c->priority, c->cid.cid_num)) {
if ((res = ast_spawn_extension(c, c->context, c->exten, c->priority, c->cid.cid_num))) {
@@ -4605,9 +4580,6 @@
the PBX, we have to make a new channel, masquerade, and start the PBX
at the new location */
struct ast_channel *tmpchan = ast_channel_alloc(0, chan->_state, 0, 0, chan->accountcode, chan->exten, chan->context, chan->amaflags, "AsyncGoto/%s", chan->name);
- if (chan->cdr) {
- tmpchan->cdr = ast_cdr_dup(chan->cdr);
- }
if (!tmpchan)
res = -1;
else {
@@ -4955,41 +4927,11 @@
return NULL;
}
-/*! Function to post an empty cdr after a spool call fails.
- *
- * This function posts an empty cdr for a failed spool call
- *
- */
-static int ast_pbx_outgoing_cdr_failed(void)
-{
- /* allocate a channel */
- struct ast_channel *chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0);
-
- if (!chan)
- return -1; /* failure */
-
- if (!chan->cdr) {
- /* allocation of the cdr failed */
- ast_channel_free(chan); /* free the channel */
- return -1; /* return failure */
- }
-
- /* allocation of the cdr was successful */
- ast_cdr_init(chan->cdr, chan); /* initialize our channel's cdr */
- ast_cdr_start(chan->cdr); /* record the start and stop time */
- ast_cdr_end(chan->cdr);
- ast_cdr_failed(chan->cdr); /* set the status to failed */
- ast_cdr_detach(chan->cdr); /* post and free the record */
- ast_channel_free(chan); /* free the channel */
-
- return 0; /* success */
-}
-
int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
{
struct ast_channel *chan;
struct async_stat *as;
- int res = -1, cdr_res = -1;
+ int res = -1;
struct outgoing_helper oh;
if (sync) {
@@ -5039,13 +4981,6 @@
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", chan->name);
- if (chan->cdr) { /* update the cdr */
- /* here we update the status of the call, which sould be busy.
- * if that fails then we set the status to failed */
- if (ast_cdr_disposition(chan->cdr, chan->hangupcause))
- ast_cdr_failed(chan->cdr);
- }
-
if (channel) {
*channel = NULL;
ast_channel_unlock(chan);
@@ -5055,14 +4990,6 @@
}
if (res < 0) { /* the call failed for some reason */
- if (*reason == 0) { /* if the call failed (not busy or no answer)
- * update the cdr with the failed message */
- cdr_res = ast_pbx_outgoing_cdr_failed();
- if (cdr_res != 0) {
- res = cdr_res;
- goto outgoing_exten_cleanup;
- }
- }
/* create a fake channel and execute the "failed" extension (if it exists) within the requested context */
/* check if "failed" exists */
@@ -5148,7 +5075,7 @@
{
struct ast_channel *chan;
struct app_tmp *tmp;
- int res = -1, cdr_res = -1;
+ int res = -1;
struct outgoing_helper oh;
memset(&oh, 0, sizeof(oh));
@@ -5164,20 +5091,6 @@
if (sync) {
chan = __ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name, &oh);
if (chan) {
- if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
- ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
- } else {
- chan->cdr = ast_cdr_alloc(); /* allocate a cdr for the channel */
- if (!chan->cdr) {
- /* allocation of the cdr failed */
- ast_free(chan->pbx);
- res = -1;
- goto outgoing_app_cleanup;
- }
- /* allocation of the cdr was successful */
- ast_cdr_init(chan->cdr, chan); /* initialize our channel's cdr */
- ast_cdr_start(chan->cdr);
- }
ast_set_variables(chan, vars);
if (account)
ast_cdr_setaccount(chan, account);
@@ -5216,24 +5129,7 @@
} else {
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Channel %s was never answered.\n", chan->name);
- if (chan->cdr) { /* update the cdr */
- /* here we update the status of the call, which sould be busy.
- * if that fails then we set the status to failed */
- if (ast_cdr_disposition(chan->cdr, chan->hangupcause))
- ast_cdr_failed(chan->cdr);
- }
ast_hangup(chan);
- }
- }
-
- if (res < 0) { /* the call failed for some reason */
- if (*reason == 0) { /* if the call failed (not busy or no answer)
- * update the cdr with the failed message */
- cdr_res = ast_pbx_outgoing_cdr_failed();
- if (cdr_res != 0) {
- res = cdr_res;
- goto outgoing_app_cleanup;
- }
}
}
@@ -6358,7 +6254,6 @@
ipri = chan->priority + (ipri * mode);
ast_explicit_goto(chan, context, exten, ipri);
- ast_cdr_update(chan);
return 0;
}
Modified: team/group/CDRfix5/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/group/CDRfix5/res/res_features.c?view=diff&rev=74509&r1=74508&r2=74509
==============================================================================
--- team/group/CDRfix5/res/res_features.c (original)
+++ team/group/CDRfix5/res/res_features.c Tue Jul 10 19:25:16 2007
@@ -254,15 +254,6 @@
tobj->peer->appl = !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge";
tobj->peer->data = tobj->chan->name;
- if (tobj->chan->cdr) {
- ast_cdr_reset(tobj->chan->cdr, NULL);
- ast_cdr_setdestchan(tobj->chan->cdr, tobj->peer->name);
- }
- if (tobj->peer->cdr) {
- ast_cdr_reset(tobj->peer->cdr, NULL);
- ast_cdr_setdestchan(tobj->peer->cdr, tobj->chan->name);
- }
-
ast_bridge_call(tobj->peer, tobj->chan, &tobj->bconfig);
if (tobj->return_to_pbx) {
@@ -1433,13 +1424,6 @@
ast_set_callerid(chan, cid_num, cid_name, cid_num);
ast_channel_inherit_variables(caller, chan);
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller->name);
- if (!chan->cdr) {
- chan->cdr=ast_cdr_alloc();
- if (chan->cdr) {
- ast_cdr_init(chan->cdr, chan); /* initilize our channel's cdr */
- ast_cdr_start(chan->cdr);
- }
- }
if (!ast_call(chan, data, timeout)) {
struct timeval started;
@@ -1582,23 +1566,6 @@
if (outstate)
*outstate = state;
- if (chan && res <= 0) {
- if (chan->cdr || (chan->cdr = ast_cdr_alloc())) {
- char tmp[256];
- ast_cdr_init(chan->cdr, chan);
- snprintf(tmp, 256, "%s/%s", type, (char *)data);
- ast_cdr_setapp(chan->cdr,"Dial",tmp);
- ast_cdr_update(chan);
- ast_cdr_start(chan->cdr);
- ast_cdr_end(chan->cdr);
- /* If the cause wasn't handled properly */
- if (ast_cdr_disposition(chan->cdr,chan->hangupcause))
- ast_cdr_failed(chan->cdr);
- } else {
- ast_log(LOG_WARNING, "Unable to create Call Detail Record\n");
- }
- }
-
return chan;
}
@@ -1684,9 +1651,6 @@
struct ast_option_header *aoh;
struct ast_bridge_config backup_config;
struct ast_cdr *bridge_cdr;
-#ifdef CDR_FIX_NOT_ANYMORE
- struct ast_cdr *threewaycdr = 0;
-#endif
memset(&backup_config, 0, sizeof(backup_config));
@@ -1738,6 +1702,7 @@
if (chan->cdr) {
ast_set_flag(chan->cdr, AST_CDR_FLAG_MAIN);
+ ast_cdr_update(chan);
bridge_cdr = ast_cdr_dup(chan->cdr);
} else {
/* better yet, in a xfer situation, find out why the chan cdr got zapped (pun unintentional) */
@@ -1935,50 +1900,6 @@
ast_copy_string(bridge_cdr->linkedid,chan->linkedid,sizeof(bridge_cdr->linkedid));
ast_cdr_end(bridge_cdr);
-
-#ifdef CDR_FIX_NOT_ANYMORE
- /* I'm not going to ask the channel drivers to track transfers -- That will come with
- the "new" event-based cdr system someday -- I get the main facts by just generating
- a CDR for a bridge. This'll simplify life considerably, I hope */
-
- /* last minute mods -- a transfer will change the CHAN to point to a different
- channel; recopy the src, clid info for CHAN into the bridge cdr now */
- if (strcmp(orig_channame,chan->name) != 0 && (strlen(chan->name) <= 8 || strcmp(chan->name+strlen(chan->name)-8 ,"<ZOMBIE>") != 0)) {
- ast_verbose(VERBOSE_PREFIX_3 "EO Bridge: Chan name changed. %s -> %s\n", orig_channame, chan->name);
-
- ast_copy_string(bridge_cdr->channel, chan->name, sizeof(bridge_cdr->channel));
- ast_copy_string(bridge_cdr->uniqueid, chan->uniqueid, sizeof(bridge_cdr->uniqueid));
- ast_cdr_setcid(bridge_cdr, chan);
- ast_copy_string(bridge_cdr->accountcode, chan->accountcode, sizeof(bridge_cdr->accountcode));
- } else if (strcmp(orig_channame,chan->name) != 0 && strlen(chan->name) > 8 && strcmp(chan->name+strlen(chan->name)-8 ,"<ZOMBIE>") == 0) {
- /* modify the lastapp, lastdata to reflect the Blind Xfer */
- strcpy(bridge_cdr->lastapp,"BLINDXFER");
- bridge_cdr->lastdata[0] = 0;
- }
-
-
- if (chan->cdr && strcmp(orig_channame,chan->name) != 0 && !chan->masqr) { /* for when bridge ends after only 1 HF (blind assisted xfer) */
- ast_verbose(VERBOSE_PREFIX_3 "Chan name change: blind xfer implied, reset start/answer\n");
- bridge_cdr->start = chan->cdr->start;
- bridge_cdr->answer = chan->cdr->start; /* the answer time got zeroed?!? */
- }
-
- if (chan->masqr) {
- /* push threewaycdr to the end of the list */
- for (threewaycdr = chan->masqr->cdr; threewaycdr; threewaycdr=threewaycdr->next)
- {
- if (strcmp(threewaycdr->lastapp,"3WAY")==0) {
- ast_verbose(VERBOSE_PREFIX_3 "Masq: 3WAY found\n");
- strcpy(bridge_cdr->lastapp, threewaycdr->lastapp);
- strcpy(bridge_cdr->lastdata, threewaycdr->lastdata);
- bridge_cdr->start = threewaycdr->start;
- bridge_cdr->answer = threewaycdr->answer;
- strcpy(bridge_cdr->uniqueid, threewaycdr->uniqueid);
- break;
[... 8 lines stripped ...]
More information about the asterisk-commits
mailing list