diff --git a/apier/v1/cdre.go b/apier/v1/cdre.go index dd3b89e85..a541fc7a1 100644 --- a/apier/v1/cdre.go +++ b/apier/v1/cdre.go @@ -25,17 +25,17 @@ import ( "encoding/json" "errors" "fmt" + "github.com/cgrates/cgrates/config" + "github.com/cgrates/cgrates/engine" + "github.com/cgrates/cgrates/utils" "io/ioutil" + "net/url" "os" "path" "strconv" "strings" "time" "unicode/utf8" - - "github.com/cgrates/cgrates/config" - "github.com/cgrates/cgrates/engine" - "github.com/cgrates/cgrates/utils" ) func (self *ApierV1) ExportCdrsToZipString(attr utils.AttrExpFileCdrs, reply *string) error { @@ -270,9 +270,16 @@ func (self *ApierV1) ExportCDRs(arg ArgExportCDRs, reply *RplExportedCDRs) (err if arg.ExportFileName != nil && len(*arg.ExportFileName) != 0 { fileName = *arg.ExportFileName } - filePath := path.Join(eDir, fileName) - if exportFormat == utils.DRYRUN { + var filePath string + switch exportFormat { + case utils.MetaFileFWV, utils.MetaFileCSV: + filePath = path.Join(eDir, fileName) + case utils.DRYRUN: filePath = utils.DRYRUN + default: + u, _ := url.Parse(eDir) + u.Path = path.Join(u.Path, fileName) + filePath = u.String() } usageMultiplyFactor := exportTemplate.UsageMultiplyFactor for k, v := range arg.UsageMultiplyFactor { @@ -296,7 +303,8 @@ func (self *ApierV1) ExportCDRs(arg ArgExportCDRs, reply *RplExportedCDRs) (err } else if len(cdrs) == 0 { return } - cdrexp, err := engine.NewCDRExporter(cdrs, exportTemplate, exportFormat, filePath, utils.META_NONE, exportID, + cdrexp, err := engine.NewCDRExporter(cdrs, exportTemplate, exportFormat, + filePath, utils.META_NONE, exportID, synchronous, attempts, fieldSep, usageMultiplyFactor, costMultiplyFactor, roundingDecimals, self.Config.HttpSkipTlsVerify, self.HTTPPoster) if err != nil {