summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorSteve Murphy <murf@digium.com>2007-04-10 05:41:34 +0000
committerSteve Murphy <murf@digium.com>2007-04-10 05:41:34 +0000
commitecaf7819337745bba5fd6a4a3a031ba2c77da331 (patch)
tree9a564f15ac25870f7fe98c097760dd5729177206 /main/channel.c
parentbe874b92d36bb654b80ecd74ea494d7ea5850b81 (diff)
Merged revisions 60989 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r60989 | murf | 2007-04-09 12:32:07 -0600 (Mon, 09 Apr 2007) | 1 line This is a big improvement over the current CDR fixes. It may still need refinement, but this won't have as many folks bothered. This also adds the mods from 1.4/r.61136; ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61152 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c32
1 files changed, 25 insertions, 7 deletions
diff --git a/main/channel.c b/main/channel.c
index 998843d7e..87be422a7 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -620,7 +620,7 @@ static const struct ast_channel_tech null_tech = {
};
/*! \brief Create a new channel structure */
-struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *name_fmt, ...)
+struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_num, const char *cid_name, const char *acctcode, const char *exten, const char *context, const int amaflag, const char *name_fmt, ...)
{
struct ast_channel *tmp;
int x;
@@ -733,6 +733,30 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
}
/* Reminder for the future: under what conditions do we NOT want to track cdrs on channels? */
+
+ /* These 4 variables need to be set up for the cdr_init() to work right */
+ if (amaflag)
+ tmp->amaflags = amaflag;
+ else
+ tmp->amaflags = ast_default_amaflags;
+
+ if (!ast_strlen_zero(acctcode))
+ ast_string_field_set(tmp, accountcode, acctcode);
+ else
+ ast_string_field_set(tmp, accountcode, ast_default_accountcode);
+
+ if (!ast_strlen_zero(context))
+ ast_copy_string(tmp->context, context, sizeof(tmp->context));
+ else
+ strcpy(tmp->context, "default");
+
+ if (!ast_strlen_zero(exten))
+ ast_copy_string(tmp->exten, exten, sizeof(tmp->exten));
+ else
+ strcpy(tmp->exten, "s");
+
+ tmp->priority = 1;
+
tmp->cdr = ast_cdr_alloc();
ast_cdr_init(tmp->cdr, tmp);
ast_cdr_start(tmp->cdr);
@@ -744,13 +768,7 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
AST_LIST_HEAD_INIT_NOLOCK(&tmp->datastores);
- strcpy(tmp->context, "default");
- strcpy(tmp->exten, "s");
- tmp->priority = 1;
-
ast_string_field_set(tmp, language, defaultlanguage);
- tmp->amaflags = ast_default_amaflags;
- ast_string_field_set(tmp, accountcode, ast_default_accountcode);
tmp->tech = &null_tech;