diff --git a/data/conf/samples/ers_internal/cgrates.json b/data/conf/samples/ers_internal/cgrates.json index 8b6ccbfb8..5dbcb7329 100644 --- a/data/conf/samples/ers_internal/cgrates.json +++ b/data/conf/samples/ers_internal/cgrates.json @@ -282,15 +282,15 @@ {"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}, ], "cache_dump_fields": [ - {"tag": "OriginID", "path":"*exp", "type": "*composed", "value": "~*req.OriginID"}, - {"tag": "OrderID", "path":"*exp", "type": "*composed", "value": "~*req.OrderID"}, - {"tag": "RequestType", "path":"*exp", "type": "*composed", "value": "~*req.RequestType"}, - {"tag": "Account", "path":"*exp", "type": "*composed", "value": "~*req.Account"}, - {"tag": "Destination", "path":"*exp", "type": "*composed", "value": "~*req.Destination"}, - {"tag": "SetupTime", "path":"*exp", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "AnswerTime", "path":"*exp", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "Usage", "path":"*exp", "type": "*composed", "value": "~*req.Usage"}, - {"tag": "Cost", "path":"*exp", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, + {"tag": "OriginID", "path":"*exp.OriginID", "type": "*composed", "value": "~*req.OriginID"}, + {"tag": "OrderID", "path":"*exp.OrderID", "type": "*composed", "value": "~*req.OrderID"}, + {"tag": "RequestType", "path":"*exp.RequestType", "type": "*composed", "value": "~*req.RequestType"}, + {"tag": "Account", "path":"*exp.Account", "type": "*composed", "value": "~*req.Account"}, + {"tag": "Destination", "path":"*exp.Destination", "type": "*composed", "value": "~*req.Destination"}, + {"tag": "SetupTime", "path":"*exp.SetupTime", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "AnswerTime", "path":"*exp.AnswerTime", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "Usage", "path":"*exp.Usage", "type": "*composed", "value": "~*req.Usage"}, + {"tag": "Cost", "path":"*exp.Cost", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, ], }, { diff --git a/data/conf/samples/ers_mongo/cgrates.json b/data/conf/samples/ers_mongo/cgrates.json index f1441c622..85fd373f9 100644 --- a/data/conf/samples/ers_mongo/cgrates.json +++ b/data/conf/samples/ers_mongo/cgrates.json @@ -283,15 +283,15 @@ {"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}, ], "cache_dump_fields": [ - {"tag": "OriginID", "path":"*exp", "type": "*composed", "value": "~*req.OriginID"}, - {"tag": "OrderID", "path":"*exp", "type": "*composed", "value": "~*req.OrderID"}, - {"tag": "RequestType", "path":"*exp", "type": "*composed", "value": "~*req.RequestType"}, - {"tag": "Account", "path":"*exp", "type": "*composed", "value": "~*req.Account"}, - {"tag": "Destination", "path":"*exp", "type": "*composed", "value": "~*req.Destination"}, - {"tag": "SetupTime", "path":"*exp", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "AnswerTime", "path":"*exp", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "Usage", "path":"*exp", "type": "*composed", "value": "~*req.Usage"}, - {"tag": "Cost", "path":"*exp", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, + {"tag": "OriginID", "path":"*exp.OriginID", "type": "*composed", "value": "~*req.OriginID"}, + {"tag": "OrderID", "path":"*exp.OrderID", "type": "*composed", "value": "~*req.OrderID"}, + {"tag": "RequestType", "path":"*exp.RequestType", "type": "*composed", "value": "~*req.RequestType"}, + {"tag": "Account", "path":"*exp.Account", "type": "*composed", "value": "~*req.Account"}, + {"tag": "Destination", "path":"*exp.Destination", "type": "*composed", "value": "~*req.Destination"}, + {"tag": "SetupTime", "path":"*exp.SetupTime", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "AnswerTime", "path":"*exp.AnswerTime", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "Usage", "path":"*exp.Usage", "type": "*composed", "value": "~*req.Usage"}, + {"tag": "Cost", "path":"*exp.Cost", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, ], }, { diff --git a/data/conf/samples/ers_mysql/cgrates.json b/data/conf/samples/ers_mysql/cgrates.json index fd8297a4b..4e7080ce5 100644 --- a/data/conf/samples/ers_mysql/cgrates.json +++ b/data/conf/samples/ers_mysql/cgrates.json @@ -280,15 +280,15 @@ {"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}, ], "cache_dump_fields": [ - {"tag": "OriginID", "path":"*exp", "type": "*composed", "value": "~*req.OriginID"}, - {"tag": "OrderID", "path":"*exp", "type": "*composed", "value": "~*req.OrderID"}, - {"tag": "RequestType", "path":"*exp", "type": "*composed", "value": "~*req.RequestType"}, - {"tag": "Account", "path":"*exp", "type": "*composed", "value": "~*req.Account"}, - {"tag": "Destination", "path":"*exp", "type": "*composed", "value": "~*req.Destination"}, - {"tag": "SetupTime", "path":"*exp", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "AnswerTime", "path":"*exp", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "Usage", "path":"*exp", "type": "*composed", "value": "~*req.Usage"}, - {"tag": "Cost", "path":"*exp", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, + {"tag": "OriginID", "path":"*exp.OriginID", "type": "*composed", "value": "~*req.OriginID"}, + {"tag": "OrderID", "path":"*exp.OrderID", "type": "*composed", "value": "~*req.OrderID"}, + {"tag": "RequestType", "path":"*exp.RequestType", "type": "*composed", "value": "~*req.RequestType"}, + {"tag": "Account", "path":"*exp.Account", "type": "*composed", "value": "~*req.Account"}, + {"tag": "Destination", "path":"*exp.Destination", "type": "*composed", "value": "~*req.Destination"}, + {"tag": "SetupTime", "path":"*exp.SetupTime", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "AnswerTime", "path":"*exp.AnswerTime", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "Usage", "path":"*exp.Usage", "type": "*composed", "value": "~*req.Usage"}, + {"tag": "Cost", "path":"*exp.Cost", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, ], }, { diff --git a/data/conf/samples/ers_postgres/cgrates.json b/data/conf/samples/ers_postgres/cgrates.json index 1da038be2..77afa282d 100644 --- a/data/conf/samples/ers_postgres/cgrates.json +++ b/data/conf/samples/ers_postgres/cgrates.json @@ -277,15 +277,15 @@ {"tag": "Partial", "path": "*cgreq.Partial", "type": "*constant", "value": "true", "filters":["*string:~*req.10:partial"]}, ], "cache_dump_fields": [ - {"tag": "OriginID", "path":"*exp", "type": "*composed", "value": "~*req.OriginID"}, - {"tag": "OrderID", "path":"*exp", "type": "*composed", "value": "~*req.OrderID"}, - {"tag": "RequestType", "path":"*exp", "type": "*composed", "value": "~*req.RequestType"}, - {"tag": "Account", "path":"*exp", "type": "*composed", "value": "~*req.Account"}, - {"tag": "Destination", "path":"*exp", "type": "*composed", "value": "~*req.Destination"}, - {"tag": "SetupTime", "path":"*exp", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "AnswerTime", "path":"*exp", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, - {"tag": "Usage", "path":"*exp", "type": "*composed", "value": "~*req.Usage"}, - {"tag": "Cost", "path":"*exp", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, + {"tag": "OriginID", "path":"*exp.OriginID", "type": "*composed", "value": "~*req.OriginID"}, + {"tag": "OrderID", "path":"*exp.OrderID", "type": "*composed", "value": "~*req.OrderID"}, + {"tag": "RequestType", "path":"*exp.RequestType", "type": "*composed", "value": "~*req.RequestType"}, + {"tag": "Account", "path":"*exp.Account", "type": "*composed", "value": "~*req.Account"}, + {"tag": "Destination", "path":"*exp.Destination", "type": "*composed", "value": "~*req.Destination"}, + {"tag": "SetupTime", "path":"*exp.SetupTime", "type": "*composed", "value": "~*req.SetupTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "AnswerTime", "path":"*exp.AnswerTime", "type": "*composed", "value": "~*req.AnswerTime", "layout": "2006-01-02T15:04:05Z07:00"}, + {"tag": "Usage", "path":"*exp.Usage", "type": "*composed", "value": "~*req.Usage"}, + {"tag": "Cost", "path":"*exp.Cost", "type": "*composed", "value": "~*req.Cost","rounding_decimals":5}, ], }, { diff --git a/engine/cdr.go b/engine/cdr.go index 985b2c277..e59ff92d6 100644 --- a/engine/cdr.go +++ b/engine/cdr.go @@ -313,21 +313,21 @@ func (cdr *CDR) combimedCdrFieldVal(cfgCdrFld *config.FCTemplate, groupCDRs []*C func (cdr *CDR) exportFieldValue(cfgCdrFld *config.FCTemplate, filterS *FilterS) (retVal string, err error) { for _, rsrFld := range cfgCdrFld.Value { var cdrVal string - switch cfgCdrFld.Tag { - case utils.COST, utils.MetaExp + utils.NestingSep + utils.COST: + switch cfgCdrFld.Path { + case utils.MetaExp + utils.NestingSep + utils.COST: cdrVal = cdr.FormatCost(cfgCdrFld.CostShiftDigits, cfgCdrFld.RoundingDecimals) - case utils.SetupTime, utils.MetaExp + utils.NestingSep + utils.SetupTime: + case utils.MetaExp + utils.NestingSep + utils.SetupTime: if cfgCdrFld.Layout == "" { cfgCdrFld.Layout = time.RFC3339 } cdrVal = cdr.SetupTime.Format(cfgCdrFld.Layout) - case utils.AnswerTime, utils.MetaExp + utils.NestingSep + utils.AnswerTime: // Format time based on layout + case utils.MetaExp + utils.NestingSep + utils.AnswerTime: // Format time based on layout if cfgCdrFld.Layout == "" { cfgCdrFld.Layout = time.RFC3339 } cdrVal = cdr.AnswerTime.Format(cfgCdrFld.Layout) - case utils.Destination, utils.MetaExp + utils.NestingSep + utils.Destination: + case utils.MetaExp + utils.NestingSep + utils.Destination: cdrVal, err = cdr.FieldAsString(rsrFld) if err != nil { return "", err @@ -413,7 +413,7 @@ func (cdr *CDR) AsExportRecord(exportFields []*config.FCTemplate, utils.MetaEC: cdr.CostDetails, }) for _, cfgFld := range exportFields { - if !strings.HasPrefix(cfgFld.Path, utils.MetaExp) { + if !strings.HasPrefix(cfgFld.Path, utils.MetaExp+utils.NestingSep) { continue } if pass, err := filterS.Pass(cdr.Tenant, diff --git a/engine/cdr_test.go b/engine/cdr_test.go index 6d43facaf..0ba52bf20 100644 --- a/engine/cdr_test.go +++ b/engine/cdr_test.go @@ -1138,7 +1138,7 @@ func TestCDRexportFieldValue(t *testing.T) { ExtraFields: map[string]string{"field_extr1": "val_extr1", "fieldextr2": "valextr2"}, } - cfgCdrFld := &config.FCTemplate{Tag: "SetupTime", Type: utils.META_COMPOSED, + cfgCdrFld := &config.FCTemplate{Path: "*exp.SetupTime", Type: utils.META_COMPOSED, Value: config.NewRSRParsersMustCompile("~SetupTime", true, utils.INFIELD_SEP)} eVal := "2013-11-07T08:42:20Z"