summaryrefslogtreecommitdiff
path: root/funcs/func_cdr.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-09-30 19:58:19 +0000
committerMatthew Jordan <mjordan@digium.com>2013-09-30 19:58:19 +0000
commitde07050d0fbbe635802281740f7bf853b015a1c2 (patch)
tree5e44aef6f977122325990df3d7e13f8292fd4c46 /funcs/func_cdr.c
parent9ede39700590629e60a7ae39e8c426c26b83dd6d (diff)
Parse arguments passed to the CDR_PROP function correctly
I can only blame this on a bad merge, because this in no way worked properly the way it was written. Mea culpa. The function should now parse its arguments correctly and function properly. (Note that the API used by the CDR_PROP function has working unit tests... this was merely bad coding of the actual registered function) (closes issue ASTERISK-22613) Reported by: Private Name ........ Merged revisions 400196 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@400197 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'funcs/func_cdr.c')
-rw-r--r--funcs/func_cdr.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/funcs/func_cdr.c b/funcs/func_cdr.c
index 6d9fb19a1..48df0a092 100644
--- a/funcs/func_cdr.c
+++ b/funcs/func_cdr.c
@@ -349,12 +349,23 @@ static int cdr_prop_write(struct ast_channel *chan, const char *cmd, char *parse
{
enum ast_cdr_options option;
- if (!strcasecmp("party_a", cmd)) {
+ AST_DECLARE_APP_ARGS(args,
+ AST_APP_ARG(variable);
+ AST_APP_ARG(options);
+ );
+
+ if (ast_strlen_zero(parse) || !value || !chan) {
+ return -1;
+ }
+
+ AST_STANDARD_APP_ARGS(args, parse);
+
+ if (!strcasecmp("party_a", args.variable)) {
option = AST_CDR_FLAG_PARTY_A;
- } else if (!strcasecmp("disable", cmd)) {
+ } else if (!strcasecmp("disable", args.variable)) {
option = AST_CDR_FLAG_DISABLE_ALL;
} else {
- ast_log(AST_LOG_WARNING, "Unknown option %s used with CDR_PROP\n", cmd);
+ ast_log(AST_LOG_WARNING, "Unknown option %s used with CDR_PROP\n", args.variable);
return 0;
}