From 9efb0b347892a1ecc4d47d5cf63ad5c67bfdf5e5 Mon Sep 17 00:00:00 2001 From: TeoV Date: Mon, 10 Sep 2018 04:12:34 -0400 Subject: [PATCH] Remove cdr_filter from cdre and cdrc --- cdrc/xml_test.go | 1 - config/cdrcconfig.go | 6 ------ config/cdreconfig.go | 7 ------- config/config_defaults.go | 2 -- config/config_json_test.go | 2 -- config/configcdrc_test.go | 4 ---- config/libconfig_json.go | 2 -- data/conf/samples/cdrcflatstore/cgrates.json | 1 - data/conf/samples/cdrcfwv/cgrates.json | 1 - data/conf/samples/cdrcfwvwithfilter/cgrates.json | 1 - data/conf/samples/cdrcxml/cgrates.json | 1 - data/conf/samples/cdrcxmlwithfilter/cgrates.json | 4 ++-- .../samples/cdrsonexpmaster/cdrsreplicationmaster.json | 3 --- engine/action.go | 3 +++ 14 files changed, 5 insertions(+), 33 deletions(-) diff --git a/cdrc/xml_test.go b/cdrc/xml_test.go index b92798fb1..8fb740f17 100644 --- a/cdrc/xml_test.go +++ b/cdrc/xml_test.go @@ -222,7 +222,6 @@ func TestXMLRPProcess(t *testing.T) { DataUsageMultiplyFactor: 1024, CDRPath: utils.HierarchyPath([]string{"broadWorksCDR", "cdrData"}), CdrSourceId: "TestXML", - CdrFilter: utils.ParseRSRFieldsMustCompile("broadWorksCDR>cdrData>headerModule>type(Normal)", utils.INFIELD_SEP), ContentFields: []*config.FCTemplate{ &config.FCTemplate{ID: "TOR", Type: utils.META_COMPOSED, FieldId: utils.ToR, Value: config.NewRSRParsersMustCompile("*voice", true), Mandatory: true}, diff --git a/config/cdrcconfig.go b/config/cdrcconfig.go index 59c14d61c..e81df5a4d 100644 --- a/config/cdrcconfig.go +++ b/config/cdrcconfig.go @@ -40,7 +40,6 @@ type CdrcConfig struct { FailedCallsPrefix string // Used in case of flatstore CDRs to avoid searching for BYE records CDRPath utils.HierarchyPath // used for XML CDRs to specify the path towards CDR elements CdrSourceId string // Source identifier for the processed CDRs - CdrFilter utils.RSRFields // Filter CDR records to import Filters []string Tenant RSRParsers ContinueOnSuccess bool // Continue after execution @@ -107,11 +106,6 @@ func (self *CdrcConfig) loadFromJsonCfg(jsnCfg *CdrcJsonCfg) error { if jsnCfg.Cdr_source_id != nil { self.CdrSourceId = *jsnCfg.Cdr_source_id } - if jsnCfg.Cdr_filter != nil { - if self.CdrFilter, err = utils.ParseRSRFields(*jsnCfg.Cdr_filter, utils.INFIELD_SEP); err != nil { - return err - } - } if jsnCfg.Filters != nil { self.Filters = make([]string, len(*jsnCfg.Filters)) for i, fltr := range *jsnCfg.Filters { diff --git a/config/cdreconfig.go b/config/cdreconfig.go index 844bf6fd3..e05bc16eb 100644 --- a/config/cdreconfig.go +++ b/config/cdreconfig.go @@ -27,7 +27,6 @@ type CdreConfig struct { ExportFormat string ExportPath string FallbackPath string - CDRFilter utils.RSRFields Filters []string Tenant string Synchronous bool @@ -44,18 +43,12 @@ func (self *CdreConfig) loadFromJsonCfg(jsnCfg *CdreJsonCfg) error { if jsnCfg == nil { return nil } - var err error if jsnCfg.Export_format != nil { self.ExportFormat = *jsnCfg.Export_format } if jsnCfg.Export_path != nil { self.ExportPath = *jsnCfg.Export_path } - if jsnCfg.Cdr_filter != nil { - if self.CDRFilter, err = utils.ParseRSRFields(*jsnCfg.Cdr_filter, utils.INFIELD_SEP); err != nil { - return err - } - } if jsnCfg.Filters != nil { self.Filters = make([]string, len(*jsnCfg.Filters)) for i, fltr := range *jsnCfg.Filters { diff --git a/config/config_defaults.go b/config/config_defaults.go index b2d73b334..e4d4396e7 100755 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -192,7 +192,6 @@ const CGRATES_CFG_JSON = ` "*default": { "export_format": "*file_csv", // exported CDRs format <*file_csv|*file_fwv|*http_post|*http_json_cdr|*http_json_map|*amqp_json_cdr|*amqp_json_map> "export_path": "/var/spool/cgrates/cdre", // path where the exported CDRs will be placed - "cdr_filter": "", // filter CDRs exported by this template "filters" :[], // new filters for cdre "tenant": "cgrates.org", // tenant used in filterS.Pass "synchronous": false, // block processing until export has a result @@ -249,7 +248,6 @@ const CGRATES_CFG_JSON = ` "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records "cdr_path": "", // path towards one CDR element in case of XML CDRs "cdr_source_id": "freeswitch_csv", // free form field, tag identifying the source of the CDRs within CDRS database - "cdr_filter": "", // filter CDR records to import "filters" :[], // new filters used in FilterS subsystem "tenant": "cgrates.org", // default tenant "continue_on_success": false, // continue to the next template if executed diff --git a/config/config_json_test.go b/config/config_json_test.go index cea06b6dd..fb62977ee 100755 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -350,7 +350,6 @@ func TestDfCdreJsonCfgs(t *testing.T) { utils.META_DEFAULT: &CdreJsonCfg{ Export_format: utils.StringPointer(utils.MetaFileCSV), Export_path: utils.StringPointer("/var/spool/cgrates/cdre"), - Cdr_filter: utils.StringPointer(""), Synchronous: utils.BoolPointer(false), Attempts: utils.IntPointer(1), Tenant: utils.StringPointer("cgrates.org"), @@ -463,7 +462,6 @@ func TestDfCdrcJsonCfg(t *testing.T) { Failed_calls_prefix: utils.StringPointer("missed_calls"), Cdr_path: utils.StringPointer(""), Cdr_source_id: utils.StringPointer("freeswitch_csv"), - Cdr_filter: utils.StringPointer(""), Filters: &[]string{}, Tenant: utils.StringPointer("cgrates.org"), Continue_on_success: utils.BoolPointer(false), diff --git a/config/configcdrc_test.go b/config/configcdrc_test.go index ffb32e6d2..2755cc234 100644 --- a/config/configcdrc_test.go +++ b/config/configcdrc_test.go @@ -48,7 +48,6 @@ func TestLoadCdrcConfigMultipleFiles(t *testing.T) { FailedCallsPrefix: "missed_calls", CDRPath: utils.HierarchyPath([]string{""}), CdrSourceId: "freeswitch_csv", - CdrFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP), Filters: []string{}, Tenant: NewRSRParsersMustCompile("cgrates.org", true), PartialRecordCache: time.Duration(10) * time.Second, @@ -127,7 +126,6 @@ func TestLoadCdrcConfigMultipleFiles(t *testing.T) { CdrOutDir: "/tmp/cgrates/cdrc1/out", CDRPath: utils.HierarchyPath([]string{""}), CdrSourceId: "csv1", - CdrFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP), Filters: []string{}, Tenant: NewRSRParsersMustCompile("cgrates.org", true), PartialRecordCache: time.Duration(10) * time.Second, @@ -206,7 +204,6 @@ func TestLoadCdrcConfigMultipleFiles(t *testing.T) { CdrOutDir: "/tmp/cgrates/cdrc2/out", CDRPath: utils.HierarchyPath([]string{""}), CdrSourceId: "csv2", - CdrFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP), Filters: []string{}, Tenant: NewRSRParsersMustCompile("cgrates.org", true), PartialRecordCache: time.Duration(10) * time.Second, @@ -269,7 +266,6 @@ func TestLoadCdrcConfigMultipleFiles(t *testing.T) { CdrOutDir: "/tmp/cgrates/cdrc3/out", CDRPath: utils.HierarchyPath([]string{""}), CdrSourceId: "csv3", - CdrFilter: utils.ParseRSRFieldsMustCompile("", utils.INFIELD_SEP), Filters: []string{}, Tenant: NewRSRParsersMustCompile("cgrates.org", true), PartialRecordCache: time.Duration(10) * time.Second, diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 5e32f2f81..3c149125e 100755 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -171,7 +171,6 @@ type CdrFieldJsonCfg struct { type CdreJsonCfg struct { Export_format *string Export_path *string - Cdr_filter *string Filters *[]string Tenant *string Synchronous *bool @@ -200,7 +199,6 @@ type CdrcJsonCfg struct { Failed_calls_prefix *string Cdr_path *string Cdr_source_id *string - Cdr_filter *string Filters *[]string Tenant *string Continue_on_success *bool diff --git a/data/conf/samples/cdrcflatstore/cgrates.json b/data/conf/samples/cdrcflatstore/cgrates.json index ca89452b4..ad291d4cb 100644 --- a/data/conf/samples/cdrcflatstore/cgrates.json +++ b/data/conf/samples/cdrcflatstore/cgrates.json @@ -42,7 +42,6 @@ "cdr_out_dir": "/tmp/cgr_flatstore/cdrc/out", // absolute path towards the directory where processed CDRs will be moved "failed_calls_prefix": "missed_calls", // used in case of flatstore CDRs to avoid searching for BYE records "cdr_source_id": "flatstore", // free form field, id identifying the source of the CDRs within CDRS database - "cdr_filter": "", // filter CDR records to import "partial_record_cache": "1s", // duration to cache partial records when not pairing "content_fields":[ // import template, id will match internally CDR field, in case of .csv value will be represented by index of the field value {"id": "Tor", "cdr_field_id": "tor", "type": "cdrfield", "value": "*voice", "mandatory": true}, diff --git a/data/conf/samples/cdrcfwv/cgrates.json b/data/conf/samples/cdrcfwv/cgrates.json index 3e4799988..84a3f0269 100644 --- a/data/conf/samples/cdrcfwv/cgrates.json +++ b/data/conf/samples/cdrcfwv/cgrates.json @@ -41,7 +41,6 @@ "cdr_in_dir": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored "cdr_out_dir": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved "cdr_source_id": "cdrc", // free form field, tag identifying the source of the CDRs within CDRS database - "cdr_filter": "", // filter CDR records to import "header_fields": [ {"id": "FileName", "field_id": "CdrFileName", "type": "*composed", "value": "~95-135", "padding":"right"}, {"id": "FileSeqNr", "field_id": "FileSeqNr", "type": "*composed", "value": "~135-141", "padding":"zeroleft"}, diff --git a/data/conf/samples/cdrcfwvwithfilter/cgrates.json b/data/conf/samples/cdrcfwvwithfilter/cgrates.json index d3168eb68..fe71bda51 100755 --- a/data/conf/samples/cdrcfwvwithfilter/cgrates.json +++ b/data/conf/samples/cdrcfwvwithfilter/cgrates.json @@ -41,7 +41,6 @@ "cdr_in_dir": "/tmp/cgr_fwv/cdrc/in", // absolute path towards the directory where the CDRs are stored "cdr_out_dir": "/tmp/cgr_fwv/cdrc/out", // absolute path towards the directory where processed CDRs will be moved "cdr_source_id": "cdrc", // free form field, id identifying the source of the CDRs within CDRS database - "cdr_filter": "", // filter CDR records to import "filters":["*string:0-10:CDR0000010"], "header_fields": [ {"id": "FileName", "field_id": "CdrFileName", "type": "*composed", "value": "~95-135", "padding":"right"}, diff --git a/data/conf/samples/cdrcxml/cgrates.json b/data/conf/samples/cdrcxml/cgrates.json index aa63a2e07..a53e75438 100644 --- a/data/conf/samples/cdrcxml/cgrates.json +++ b/data/conf/samples/cdrcxml/cgrates.json @@ -26,7 +26,6 @@ "cdr_out_dir": "/tmp/cdrctests/xmlit1/out", "cdr_path": "broadWorksCDR>cdrData", "cdr_source_id": "xmlit1", - "cdr_filter": "broadWorksCDR>cdrData>headerModule>type(Normal)", "content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value {"id": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true}, {"id": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "~broadWorksCDR>cdrData>basicModule>localCallId", "mandatory": true}, diff --git a/data/conf/samples/cdrcxmlwithfilter/cgrates.json b/data/conf/samples/cdrcxmlwithfilter/cgrates.json index bc2327412..fedfbbe3c 100755 --- a/data/conf/samples/cdrcxmlwithfilter/cgrates.json +++ b/data/conf/samples/cdrcxmlwithfilter/cgrates.json @@ -46,10 +46,10 @@ "enabled": true, // enable CDR client functionality "cdr_format": "xml", // CDR file format "cdr_in_dir": "/tmp/cdrcxmlwithfilters2/xmlit2/in", - "cdr_out_dir": "/tmp/cdrcxmlwithfilters2/xmlit2/out", + "cdr_out_dir": "/tmp/cdrcxmlwithfilters2/xmlit2/out", "cdr_path": "File>CDRs>Call", // path towards one CDR element in case of XML CDRs "cdr_source_id": "zw_cfs1", // free form field, tag identifying the source of the CDRs within CDRS database - "content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value + "content_fields":[ // import content_fields template, id will match internally CDR field, in case of .csv value will be represented by index of the field value {"id": "TOR", "field_id": "ToR", "type": "*composed", "value": "*voice", "mandatory": true}, {"id": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "~File>CDRs>Call>SignalingInfo>PChargingVector>icidvalue", "mandatory": true}, {"id": "RequestType", "field_id": "RequestType", "type": "*composed", "value": "*rated", "mandatory": true}, diff --git a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json b/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json index d46e34c97..a38bf822f 100644 --- a/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json +++ b/data/conf/samples/cdrsonexpmaster/cdrsreplicationmaster.json @@ -30,7 +30,6 @@ "http_localhost": { "export_format": "*http_post", "export_path": "http://127.0.0.1:12080/cdr_http", - "cdr_filter": "RunID(*default);OriginID(httpjsonrpc1)", "content_fields": [ // template of the exported content fields {"id": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, {"id":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"}, @@ -54,7 +53,6 @@ "export_format": "*amqp_json_map", "export_path": "amqp://guest:guest@localhost:5672/?queue_id=cgrates_cdrs", "attempts": 3, - "cdr_filter": "RunID(*default)", "content_fields": [ // template of the exported content fields {"id": "CGRID", "type": "*composed", "value": "~CGRID", "field_id": "CGRID"}, {"id":"RunID", "type": "*composed", "value": "~RunID", "field_id": "RunID"}, @@ -77,7 +75,6 @@ "http_test_file": { "export_format": "*http_post", "export_path": "http://127.0.0.1:12080/invalid", - "cdr_filter": "OriginID(httpjsonrpc1)", "content_fields": [ {"id": "OriginID", "type": "*composed", "value": "~OriginID", "field_id": "OriginID"}, ], diff --git a/engine/action.go b/engine/action.go index 25757a9cc..4f8cc455b 100644 --- a/engine/action.go +++ b/engine/action.go @@ -338,6 +338,9 @@ func cdrLogAction(acc *Account, sq *CDRStatsQueueTriggered, a *Action, acs Actio if cdrStorage == nil { // Only save if the cdrStorage is defined continue } + // ar trebui sa faca post cdr sa il trimita la cdr server + // de vazut cum + // de adaugat extra conexiune if err := cdrStorage.SetCDR(cdr, true); err != nil { return err }