ensure proper variables are returned from CDR function (bug #4521)
[asterisk/asterisk.git] / cdr.c
diff --git a/cdr.c b/cdr.c
index 6ea359b..e04188a 100755 (executable)
--- a/cdr.c
+++ b/cdr.c
@@ -203,13 +203,13 @@ void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *wor
                        strftime(workspace, workspacelen, fmt, &tm);
                }
        } else if (!strcasecmp(name, "answer")) {
-               t = cdr->start.tv_sec;
+               t = cdr->answer.tv_sec;
                if (t) {
                        localtime_r(&t, &tm);
                        strftime(workspace, workspacelen, fmt, &tm);
                }
        } else if (!strcasecmp(name, "end")) {
-               t = cdr->start.tv_sec;
+               t = cdr->end.tv_sec;
                if (t) {
                        localtime_r(&t, &tm);
                        strftime(workspace, workspacelen, fmt, &tm);