#include "asterisk.h"
#include "asterisk/module.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/utils.h"
#include "asterisk/app.h"
#include "asterisk/cdr.h"
Go to the source code of this file.
Enumerations | |
enum | { OPT_RECURSIVE = (1 << 0), OPT_UNPARSED = (1 << 1), OPT_LAST = (1 << 2), OPT_SKIPLOCKED = (1 << 3) } |
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
static int | cdr_read (struct ast_channel *chan, const char *cmd, char *parse, char *buf, size_t len) |
static int | cdr_write (struct ast_channel *chan, const char *cmd, char *parse, const char *value) |
static int | load_module (void) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Call Detail Record (CDR) dialplan function" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } |
static struct ast_module_info * | ast_module_info = &__mod_info |
static struct ast_app_option | cdr_func_options [128] = { [ 'l' ] = { .flag = OPT_LAST }, [ 'r' ] = { .flag = OPT_RECURSIVE }, [ 's' ] = { .flag = OPT_SKIPLOCKED }, [ 'u' ] = { .flag = OPT_UNPARSED },} |
static struct ast_custom_function | cdr_function |
enum { ... } | cdr_option_flags |
Definition in file func_cdr.c.
anonymous enum |
Definition at line 39 of file func_cdr.c.
00039 { 00040 OPT_RECURSIVE = (1 << 0), 00041 OPT_UNPARSED = (1 << 1), 00042 OPT_LAST = (1 << 2), 00043 OPT_SKIPLOCKED = (1 << 3), 00044 } cdr_option_flags;
static void __reg_module | ( | void | ) | [static] |
Definition at line 181 of file func_cdr.c.
static void __unreg_module | ( | void | ) | [static] |
Definition at line 181 of file func_cdr.c.
static int cdr_read | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | parse, | |||
char * | buf, | |||
size_t | len | |||
) | [static] |
Definition at line 53 of file func_cdr.c.
References AST_APP_ARG, ast_app_parse_options(), AST_CDR_FLAG_LOCKED, ast_cdr_getvar(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), ast_test_flag, ast_channel::cdr, cdr_func_options, chan, ast_cdr::flags, ast_flags::flags, ast_cdr::next, OPT_LAST, OPT_RECURSIVE, OPT_SKIPLOCKED, and OPT_UNPARSED.
00055 { 00056 char *ret; 00057 struct ast_flags flags = { 0 }; 00058 struct ast_cdr *cdr = chan ? chan->cdr : NULL; 00059 AST_DECLARE_APP_ARGS(args, 00060 AST_APP_ARG(variable); 00061 AST_APP_ARG(options); 00062 ); 00063 00064 if (ast_strlen_zero(parse)) 00065 return -1; 00066 00067 if (!cdr) 00068 return -1; 00069 00070 AST_STANDARD_APP_ARGS(args, parse); 00071 00072 if (!ast_strlen_zero(args.options)) 00073 ast_app_parse_options(cdr_func_options, &flags, NULL, args.options); 00074 00075 if (ast_test_flag(&flags, OPT_LAST)) 00076 while (cdr->next) 00077 cdr = cdr->next; 00078 00079 if (ast_test_flag(&flags, OPT_SKIPLOCKED)) 00080 while (ast_test_flag(cdr, AST_CDR_FLAG_LOCKED) && cdr->next) 00081 cdr = cdr->next; 00082 00083 ast_cdr_getvar(cdr, args.variable, &ret, buf, len, 00084 ast_test_flag(&flags, OPT_RECURSIVE), 00085 ast_test_flag(&flags, OPT_UNPARSED)); 00086 00087 return ret ? 0 : -1; 00088 }
static int cdr_write | ( | struct ast_channel * | chan, | |
const char * | cmd, | |||
char * | parse, | |||
const char * | value | |||
) | [static] |
Definition at line 90 of file func_cdr.c.
References AST_APP_ARG, ast_app_parse_options(), ast_cdr_setaccount(), ast_cdr_setamaflags(), ast_cdr_setuserfield(), ast_cdr_setvar(), AST_DECLARE_APP_ARGS, AST_STANDARD_APP_ARGS, ast_strlen_zero(), ast_test_flag, ast_channel::cdr, cdr_func_options, chan, ast_flags::flags, ast_cdr::next, OPT_LAST, and OPT_RECURSIVE.
00092 { 00093 struct ast_cdr *cdr = chan ? chan->cdr : NULL; 00094 struct ast_flags flags = { 0 }; 00095 AST_DECLARE_APP_ARGS(args, 00096 AST_APP_ARG(variable); 00097 AST_APP_ARG(options); 00098 ); 00099 00100 if (ast_strlen_zero(parse) || !value || !chan) 00101 return -1; 00102 00103 if (!cdr) 00104 return -1; 00105 00106 AST_STANDARD_APP_ARGS(args, parse); 00107 00108 if (!ast_strlen_zero(args.options)) 00109 ast_app_parse_options(cdr_func_options, &flags, NULL, args.options); 00110 00111 if (ast_test_flag(&flags, OPT_LAST)) 00112 while (cdr->next) 00113 cdr = cdr->next; 00114 00115 if (!strcasecmp(args.variable, "accountcode")) /* the 'l' flag doesn't apply to setting the accountcode, userfield, or amaflags */ 00116 ast_cdr_setaccount(chan, value); 00117 else if (!strcasecmp(args.variable, "userfield")) 00118 ast_cdr_setuserfield(chan, value); 00119 else if (!strcasecmp(args.variable, "amaflags")) 00120 ast_cdr_setamaflags(chan, value); 00121 else 00122 ast_cdr_setvar(cdr, args.variable, value, ast_test_flag(&flags, OPT_RECURSIVE)); 00123 /* No need to worry about the u flag, as all fields for which setting 00124 * 'u' would do anything are marked as readonly. */ 00125 00126 return 0; 00127 }
static int load_module | ( | void | ) | [static] |
Definition at line 176 of file func_cdr.c.
References ast_custom_function_register, and cdr_function.
00177 { 00178 return ast_custom_function_register(&cdr_function); 00179 }
static int unload_module | ( | void | ) | [static] |
Definition at line 171 of file func_cdr.c.
References ast_custom_function_unregister(), and cdr_function.
00172 { 00173 return ast_custom_function_unregister(&cdr_function); 00174 }
struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Call Detail Record (CDR) dialplan function" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "a9c98e5d177805051735cb5b0b16b0a0" , .load = load_module, .unload = unload_module, } [static] |
Definition at line 181 of file func_cdr.c.
struct ast_module_info* ast_module_info = &__mod_info [static] |
Definition at line 181 of file func_cdr.c.
struct ast_app_option cdr_func_options[128] = { [ 'l' ] = { .flag = OPT_LAST }, [ 'r' ] = { .flag = OPT_RECURSIVE }, [ 's' ] = { .flag = OPT_SKIPLOCKED }, [ 'u' ] = { .flag = OPT_UNPARSED },} [static] |
struct ast_custom_function cdr_function [static] |
enum { ... } cdr_option_flags |