Add peercontext parameter for default outbound context (bug #1929)
[asterisk/asterisk.git] / cdr / cdr_csv.c
index c669652..8c553db 100755 (executable)
@@ -19,6 +19,7 @@
 #include <asterisk/cdr.h>
 #include <asterisk/module.h>
 #include <asterisk/logger.h>
+#include <asterisk/utils.h>
 #include "../asterisk.h"
 #include "../astconf.h"
 
@@ -209,7 +210,7 @@ static int csv_log(struct ast_cdr *cdr)
        printf("[CDR] %s ('%s' -> '%s') Dur: %ds Bill: %ds Disp: %s Flags: %s Account: [%s]\n", cdr->channel, cdr->src, cdr->dst, cdr->duration, cdr->billsec, ast_cdr_disp2str(cdr->disposition), ast_cdr_flags2str(cdr->amaflags), cdr->accountcode);
 #endif
        if (build_csv_record(buf, sizeof(buf), cdr)) {
-               ast_log(LOG_WARNING, "Unable to create CSV record in %d bytes.  CDR not recorded!\n", sizeof(buf));
+               ast_log(LOG_WARNING, "Unable to create CSV record in %d bytes.  CDR not recorded!\n", (int)sizeof(buf));
        } else {
                /* because of the absolutely unconditional need for the
                   highest reliability possible in writing billing records,
@@ -224,7 +225,7 @@ static int csv_log(struct ast_cdr *cdr)
                        fclose(mf);
                        mf = NULL;
                }
-               if (strlen(cdr->accountcode)) {
+               if (!ast_strlen_zero(cdr->accountcode)) {
                        if (writefile(buf, cdr->accountcode))
                                ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s'\n", cdr->accountcode);
                }