[Asterisk-cvs] asterisk/apps app_forkcdr.c,1.5,1.6
markster at lists.digium.com
markster at lists.digium.com
Wed Feb 23 16:50:28 CST 2005
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv14508/apps
Modified Files:
app_forkcdr.c
Log Message:
Merge anthm's CDR updates (bug #3595)
Index: app_forkcdr.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_forkcdr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- app_forkcdr.c 16 Feb 2005 02:58:17 -0000 1.5
+++ app_forkcdr.c 23 Feb 2005 22:48:47 -0000 1.6
@@ -25,8 +25,10 @@
static char *synopsis =
"Forks the Call Data Record";
static char *descrip =
-" ForkCDR(): Causes the Call Data Record to fork an additional\n"
- "cdr record starting from the time of the fork call\n";
+" ForkCDR([options]): Causes the Call Data Record to fork an additional\n"
+ "cdr record starting from the time of the fork call\n"
+"If the option 'v' is passed all cdr variables will be passed along also.\n"
+"";
STANDARD_LOCAL_USER;
@@ -34,17 +36,24 @@
LOCAL_USER_DECL;
-static void ast_cdr_clone(struct ast_cdr *cdr) {
+static void ast_cdr_clone(struct ast_cdr *cdr)
+{
struct ast_cdr *newcdr = ast_cdr_alloc();
memcpy(newcdr,cdr,sizeof(struct ast_cdr));
ast_cdr_append(cdr,newcdr);
gettimeofday(&newcdr->start, NULL);
memset(&newcdr->answer, 0, sizeof(newcdr->answer));
+ memset(&newcdr->varshead, 0, sizeof(newcdr->varshead));
+ ast_cdr_copy_vars(newcdr, cdr);
+ if (!ast_test_flag(cdr, AST_CDR_FLAG_KEEP_VARS)) {
+ ast_cdr_free_vars(cdr, 0);
+ }
newcdr->disposition = AST_CDR_NOANSWER;
ast_set_flag(cdr, AST_CDR_FLAG_CHILD|AST_CDR_FLAG_LOCKED);
}
-static void ast_cdr_fork(struct ast_channel *chan) {
+static void ast_cdr_fork(struct ast_channel *chan)
+{
if(chan && chan->cdr) {
ast_cdr_clone(chan->cdr);
}
@@ -55,7 +64,8 @@
int res=0;
struct localuser *u;
LOCAL_USER_ADD(u);
-
+ ast_set2_flag(chan->cdr, strchr((char *)data, 'v'), AST_CDR_FLAG_KEEP_VARS);
+
ast_cdr_fork(chan);
LOCAL_USER_REMOVE(u);
More information about the svn-commits
mailing list