#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "asterisk.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 | |
void | ast_cdr_fork (struct ast_channel *chan) |
char * | description (void) |
Provides a description of the module. | |
int | forkcdr_exec (struct ast_channel *chan, void *data) |
char * | key () |
Returns the ASTERISK_GPL_KEY. | |
int | load_module (void) |
Initialize the module. | |
int | unload_module (void) |
Cleanup all module structures, sockets, etc. | |
int | usecount (void) |
Provides a usecount. | |
Variables | |
char * | app = "ForkCDR" |
char * | descrip |
LOCAL_USER_DECL | |
STANDARD_LOCAL_USER | |
char * | synopsis |
char * | tdesc = "Fork The CDR into 2 separate entities." |
Definition in file app_forkcdr.c.
|
Definition at line 56 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(). 00057 { 00058 struct ast_cdr *cdr; 00059 struct ast_cdr *newcdr; 00060 struct ast_flags flags = { AST_CDR_FLAG_KEEP_VARS }; 00061 00062 cdr = chan->cdr; 00063 00064 while (cdr->next) 00065 cdr = cdr->next; 00066 00067 if (!(newcdr = ast_cdr_dup(cdr))) 00068 return; 00069 00070 ast_cdr_append(cdr, newcdr); 00071 ast_cdr_reset(newcdr, &flags); 00072 00073 if (!ast_test_flag(cdr, AST_CDR_FLAG_KEEP_VARS)) 00074 ast_cdr_free_vars(cdr, 0); 00075 00076 ast_set_flag(cdr, AST_CDR_FLAG_CHILD | AST_CDR_FLAG_LOCKED); 00077 }
|
|
Provides a description of the module.
Definition at line 116 of file app_forkcdr.c. 00117 {
00118 return tdesc;
00119 }
|
|
Definition at line 79 of file app_forkcdr.c. References AST_CDR_FLAG_KEEP_VARS, ast_cdr_fork(), ast_log(), ast_set2_flag, ast_strlen_zero(), ast_channel::cdr, LOCAL_USER_ADD, LOCAL_USER_REMOVE, and LOG_WARNING. Referenced by load_module(). 00080 { 00081 int res = 0; 00082 struct localuser *u; 00083 00084 if (!chan->cdr) { 00085 ast_log(LOG_WARNING, "Channel does not have a CDR\n"); 00086 return 0; 00087 } 00088 00089 LOCAL_USER_ADD(u); 00090 00091 if (!ast_strlen_zero(data)) 00092 ast_set2_flag(chan->cdr, strchr(data, 'v'), AST_CDR_FLAG_KEEP_VARS); 00093 00094 ast_cdr_fork(chan); 00095 00096 LOCAL_USER_REMOVE(u); 00097 return res; 00098 }
|
|
Returns the ASTERISK_GPL_KEY. This returns the ASTERISK_GPL_KEY, signifiying that you agree to the terms of the GPL stated in the ASTERISK_GPL_KEY. Your module will not load if it does not return the EXACT message:
char *key(void) { return ASTERISK_GPL_KEY; }
Definition at line 128 of file app_forkcdr.c. 00129 {
00130 return ASTERISK_GPL_KEY;
00131 }
|
|
Initialize the module. Initialize the Agents module. This function is being called by Asterisk when loading the module. Among other thing it registers applications, cli commands and reads the cofiguration file.
Definition at line 111 of file app_forkcdr.c. References app, ast_register_application(), descrip, forkcdr_exec(), and synopsis. 00112 { 00113 return ast_register_application(app, forkcdr_exec, synopsis, descrip); 00114 }
|
|
Cleanup all module structures, sockets, etc. This is called at exit. Any registrations and memory allocations need to be unregistered and free'd here. Nothing else will do these for you (until exit).
Definition at line 100 of file app_forkcdr.c. References app, and ast_unregister_application(). 00101 { 00102 int res; 00103 00104 res = ast_unregister_application(app); 00105 00106 STANDARD_HANGUP_LOCALUSERS; 00107 00108 return res; 00109 }
|
|
Provides a usecount. This function will be called by various parts of asterisk. Basically, all it has to do is to return a usecount when called. You will need to maintain your usecount within the module somewhere. The usecount should be how many channels provided by this module are in use.
Definition at line 121 of file app_forkcdr.c. References STANDARD_USECOUNT. 00122 { 00123 int res; 00124 STANDARD_USECOUNT(res); 00125 return res; 00126 }
|
|
Definition at line 42 of file app_forkcdr.c. Referenced by load_module(), and unload_module(). |
|
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 45 of file app_forkcdr.c. Referenced by load_module(). |
|
Definition at line 54 of file app_forkcdr.c. |
|
Definition at line 52 of file app_forkcdr.c. |
|
Initial value:
"Forks the Call Data Record"
Definition at line 43 of file app_forkcdr.c. Referenced by load_module(). |
|
Definition at line 41 of file app_forkcdr.c. |