diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 23:12:41 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-02-23 23:12:41 +0000 |
commit | d14ce4c739b8a89811bf27532628c8cc7ce8d6e9 (patch) | |
tree | 24202e7bc10859a618b871e519d945ed1744b857 /funcs/func_cdr.c | |
parent | eaf5d33648cb2db65109220dd917f7e814133bee (diff) |
Bug 6417 - Allow retrieval of raw CDR values
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@10953 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs/func_cdr.c')
-rw-r--r-- | funcs/func_cdr.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c index d287ff98a..1df7f14ad 100644 --- a/funcs/func_cdr.c +++ b/funcs/func_cdr.c @@ -41,10 +41,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") enum { OPT_RECURSIVE = (1 << 0), + OPT_UNPARSED = (1 << 1), } cdr_option_flags; AST_APP_OPTIONS(cdr_func_options, { AST_APP_OPTION('r', OPT_RECURSIVE), + AST_APP_OPTION('u', OPT_UNPARSED), }); static int cdr_read(struct ast_channel *chan, char *cmd, char *parse, @@ -69,7 +71,8 @@ static int cdr_read(struct ast_channel *chan, char *cmd, char *parse, ast_app_parse_options(cdr_func_options, &flags, NULL, args.options); ast_cdr_getvar(chan->cdr, args.variable, &ret, buf, len, - ast_test_flag(&flags, OPT_RECURSIVE)); + ast_test_flag(&flags, OPT_RECURSIVE), + ast_test_flag(&flags, OPT_UNPARSED)); return 0; } @@ -96,8 +99,9 @@ static int cdr_write(struct ast_channel *chan, char *cmd, char *parse, else if (!strcasecmp(args.variable, "userfield")) ast_cdr_setuserfield(chan, value); else if (chan->cdr) - ast_cdr_setvar(chan->cdr, args.variable, value, - ast_test_flag(&flags, OPT_RECURSIVE)); + ast_cdr_setvar(chan->cdr, args.variable, value, ast_test_flag(&flags, OPT_RECURSIVE)); + /* No need to worry about the u flag, as all fields for which setting + * 'u' would do anything are marked as readonly. */ return 0; } @@ -105,10 +109,17 @@ static int cdr_write(struct ast_channel *chan, char *cmd, char *parse, static struct ast_custom_function cdr_function = { .name = "CDR", .synopsis = "Gets or sets a CDR variable", - .desc = "Option 'r' searches the entire stack of CDRs on the channel\n", .syntax = "CDR(<name>[|options])", .read = cdr_read, .write = cdr_write, + .desc = +"Options:\n" +" 'r' searches the entire stack of CDRs on the channel\n" +" 'u' retrieves the raw, unprocessed value\n" +" For example, 'start', 'answer', and 'end' will be retrieved as epoch\n" +" values, when the n option is passed, but formatted as YYYY-MM-DD HH:MM:SS\n" +" otherwise. Similarly, disposition and amaflags will return their raw\n" +" integral values.\n", }; static char *tdesc = "CDR dialplan function"; |