[asterisk-commits] rmudgett: trunk r397901 - in /trunk: ./ main/cdr.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Aug 28 17:56:04 CDT 2013
Author: rmudgett
Date: Wed Aug 28 17:56:03 2013
New Revision: 397901
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397901
Log:
Fixed problems with ast_cdr_serialize_variables().
* Fixed return value of ast_cdr_serialize_variables() on error. It needs
to return 0 indicating no CDR variables found.
* Made ast_cdr_serialize_variables() check the return value of
cdr_object_format_property() and assert if nonzero. A member of the
cdr_readonly_vars[] was not handled.
* Removed unused elements from cdr_readonly_vars[]: total_duration,
total_billsec, first_start, and first_answer.
........
Merged revisions 397900 from http://svn.asterisk.org/svn/asterisk/branches/12
Modified:
trunk/ (props changed)
trunk/main/cdr.c
Propchange: trunk/
------------------------------------------------------------------------------
--- branch-12-merged (original)
+++ branch-12-merged Wed Aug 28 17:56:03 2013
@@ -1,1 +1,1 @@
-/branches/12:1-397816,397854,397856,397859,397870,397874,397876,397885,397892,397894,397896,397898
+/branches/12:1-397816,397854,397856,397859,397870,397874,397876,397885,397892,397894,397896,397898,397900
Modified: trunk/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/cdr.c?view=diff&rev=397901&r1=397900&r2=397901
==============================================================================
--- trunk/main/cdr.c (original)
+++ trunk/main/cdr.c Wed Aug 28 17:56:03 2013
@@ -2862,11 +2862,29 @@
}
/* Read Only CDR variables */
-static const char * const cdr_readonly_vars[] = { "clid", "src", "dst", "dcontext",
- "channel", "dstchannel", "lastapp", "lastdata", "start", "answer", "end", "duration",
- "billsec", "disposition", "amaflags", "accountcode", "uniqueid", "linkedid",
- "userfield", "sequence", "total_duration", "total_billsec", "first_start",
- "first_answer", NULL };
+static const char * const cdr_readonly_vars[] = {
+ "clid",
+ "src",
+ "dst",
+ "dcontext",
+ "channel",
+ "dstchannel",
+ "lastapp",
+ "lastdata",
+ "start",
+ "answer",
+ "end",
+ "duration",
+ "billsec",
+ "disposition",
+ "amaflags",
+ "accountcode",
+ "uniqueid",
+ "linkedid",
+ "userfield",
+ "sequence",
+ NULL
+};
int ast_cdr_setvar(const char *channel_name, const char *name, const char *value)
{
@@ -3036,12 +3054,12 @@
int total = 0, x = 0, i;
if (!workspace) {
- return 1;
+ return 0;
}
if (!cdr) {
ast_log(AST_LOG_ERROR, "Unable to find CDR for channel %s\n", channel_name);
- return 1;
+ return 0;
}
ast_str_reset(*buf);
@@ -3067,7 +3085,11 @@
for (i = 0; cdr_readonly_vars[i]; i++) {
/* null out the workspace, because the cdr_get_tv() won't write anything if time is NULL, so you get old vals */
workspace[0] = 0;
- cdr_object_format_property(it_cdr, cdr_readonly_vars[i], workspace, sizeof(workspace));
+ if (cdr_object_format_property(it_cdr, cdr_readonly_vars[i], workspace, sizeof(workspace))) {
+ /* Unhandled read-only CDR variable. */
+ ast_assert(0);
+ continue;
+ }
if (!ast_strlen_zero(workspace)
&& ast_str_append(buf, 0, "level %d: %s%c%s%c", x, cdr_readonly_vars[i], delim, workspace, sep) < 0) {
More information about the asterisk-commits
mailing list