Remove cdr_filter from cdre and cdrc

This commit is contained in:
TeoV
2018-09-10 04:12:34 -04:00
committed by Dan Christian Bogos
parent 0a8c6f609e
commit 9efb0b3478
14 changed files with 5 additions and 33 deletions

View File

@@ -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},

View File

@@ -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 {

View File

@@ -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 {

View File

@@ -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

View File

@@ -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),

View File

@@ -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,

View File

@@ -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

View File

@@ -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},

View File

@@ -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"},

View File

@@ -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"},

View File

@@ -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},

View File

@@ -46,10 +46,10 @@
"enabled": true, // enable CDR client functionality
"cdr_format": "xml", // CDR file format <csv|freeswitch_csv|fwv|opensips_flatstore|partial_csv>
"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},

View File

@@ -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"},
],

View File

@@ -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
}