From 2e6a0f4d014737691ecfc46596445124cae05be9 Mon Sep 17 00:00:00 2001 From: TeoV Date: Fri, 17 Nov 2017 13:23:57 +0200 Subject: [PATCH] CDRExporter filename fixed (.csv and .fwv) --- apier/v1/cdre.go | 11 ++++++++++- apier/v2/cdre.go | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/apier/v1/cdre.go b/apier/v1/cdre.go index 177636164..aec771e74 100644 --- a/apier/v1/cdre.go +++ b/apier/v1/cdre.go @@ -267,7 +267,16 @@ func (self *ApierV1) ExportCDRs(arg ArgExportCDRs, reply *RplExportedCDRs) (err if arg.ExportID != nil && len(*arg.ExportID) != 0 { exportID = *arg.ExportID } - fileName := fmt.Sprintf("cdre_%s.%s", exportID, exportFormat) + var expFormat string + switch exportFormat { + case utils.MetaFileFWV: + expFormat = "fwv" + case utils.MetaFileCSV: + expFormat = "csv" + default: + expFormat = exportFormat + } + fileName := fmt.Sprintf("cdre_%s.%s", exportID, expFormat) if arg.ExportFileName != nil && len(*arg.ExportFileName) != 0 { fileName = *arg.ExportFileName } diff --git a/apier/v2/cdre.go b/apier/v2/cdre.go index 46ec12f13..068dd8e5b 100644 --- a/apier/v2/cdre.go +++ b/apier/v2/cdre.go @@ -89,7 +89,16 @@ func (self *ApierV2) ExportCdrsToFile(attr AttrExportCdrsToFile, reply *Exported if attr.ExportID != nil && len(*attr.ExportID) != 0 { exportID = *attr.ExportID } - fileName := fmt.Sprintf("cdre_%s.%s", exportID, exportFormat) + var expFormat string + switch exportFormat { + case utils.MetaFileFWV: + expFormat = "fwv" + case utils.MetaFileCSV: + expFormat = "csv" + default: + expFormat = exportFormat + } + fileName := fmt.Sprintf("cdre_%s.%s", exportID, expFormat) if attr.ExportFileName != nil && len(*attr.ExportFileName) != 0 { fileName = *attr.ExportFileName }