diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-23 22:48:47 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-02-23 22:48:47 +0000 |
commit | 6898f073dee1b0642ab4d3bc5da03721bdd7e5ba (patch) | |
tree | 5cac482ff6e93ba883893efeabb3ed534e83e9d0 /apps/app_forkcdr.c | |
parent | f8adb7e1138998183c958889748cc53648942a7a (diff) |
Merge anthm's CDR updates (bug #3595)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@5068 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_forkcdr.c')
-rwxr-xr-x | apps/app_forkcdr.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index c2ef00b46..64679b551 100755 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -25,8 +25,10 @@ static char *app = "ForkCDR"; 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 @@ STANDARD_LOCAL_USER; 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 @@ static int forkcdr_exec(struct ast_channel *chan, void *data) 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); |