#include "asterisk.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/cdr.h"
#include "asterisk/module.h"
Go to the source code of this file.
Functions | |
static void | ast_cdr_fork (struct ast_channel *chan) |
AST_MODULE_INFO_STANDARD (ASTERISK_GPL_KEY,"Fork The CDR into 2 separate entities") | |
static int | forkcdr_exec (struct ast_channel *chan, void *data) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static char * | app = "ForkCDR" |
static char * | descrip |
static char * | synopsis |
Definition in file app_forkcdr.c.
static void ast_cdr_fork | ( | struct ast_channel * | chan | ) | [static] |
Definition at line 54 of file app_forkcdr.c.
References ast_cdr_append(), ast_cdr_dup(), AST_CDR_FLAG_CHILD, AST_CDR_FLAG_KEEP_VARS, AST_CDR_FLAG_LOCKED, ast_cdr_free_vars(), ast_cdr_reset(), ast_set_flag, ast_test_flag, ast_channel::cdr, and ast_cdr::next.
Referenced by forkcdr_exec().
00055 { 00056 struct ast_cdr *cdr; 00057 struct ast_cdr *newcdr; 00058 struct ast_flags flags = { AST_CDR_FLAG_KEEP_VARS }; 00059 00060 cdr = chan->cdr; 00061 00062 while (cdr->next) 00063 cdr = cdr->next; 00064 00065 if (!(newcdr = ast_cdr_dup(cdr))) 00066 return; 00067 00068 ast_cdr_append(cdr, newcdr); 00069 ast_cdr_reset(newcdr, &flags); 00070 00071 if (!ast_test_flag(cdr, AST_CDR_FLAG_KEEP_VARS)) 00072 ast_cdr_free_vars(cdr, 0); 00073 00074 ast_set_flag(cdr, AST_CDR_FLAG_CHILD | AST_CDR_FLAG_LOCKED); 00075 }
AST_MODULE_INFO_STANDARD | ( | ASTERISK_GPL_KEY | , | |
"Fork The CDR into 2 separate entities" | ||||
) |
static int forkcdr_exec | ( | struct ast_channel * | chan, | |
void * | data | |||
) | [static] |
Definition at line 77 of file app_forkcdr.c.
References AST_CDR_FLAG_KEEP_VARS, ast_cdr_fork(), ast_log(), ast_module_user_add, ast_module_user_remove, ast_set2_flag, ast_strlen_zero(), ast_channel::cdr, and LOG_WARNING.
Referenced by load_module().
00078 { 00079 int res = 0; 00080 struct ast_module_user *u; 00081 00082 if (!chan->cdr) { 00083 ast_log(LOG_WARNING, "Channel does not have a CDR\n"); 00084 return 0; 00085 } 00086 00087 u = ast_module_user_add(chan); 00088 00089 if (!ast_strlen_zero(data)) 00090 ast_set2_flag(chan->cdr, strchr(data, 'v'), AST_CDR_FLAG_KEEP_VARS); 00091 00092 ast_cdr_fork(chan); 00093 00094 ast_module_user_remove(u); 00095 return res; 00096 }
static int load_module | ( | void | ) | [static] |
Definition at line 109 of file app_forkcdr.c.
References ast_register_application(), and forkcdr_exec().
00110 { 00111 return ast_register_application(app, forkcdr_exec, synopsis, descrip); 00112 }
static int unload_module | ( | void | ) | [static] |
Definition at line 98 of file app_forkcdr.c.
References ast_module_user_hangup_all, and ast_unregister_application().
00099 { 00100 int res; 00101 00102 res = ast_unregister_application(app); 00103 00104 ast_module_user_hangup_all(); 00105 00106 return res; 00107 }
char* app = "ForkCDR" [static] |
Definition at line 45 of file app_forkcdr.c.
char* descrip [static] |
Initial value:
" 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"
Definition at line 48 of file app_forkcdr.c.
char* synopsis [static] |