diff --git a/config/cfg_data.json b/config/cfg_data.json index a06cf7995..96a18a79d 100644 --- a/config/cfg_data.json +++ b/config/cfg_data.json @@ -33,6 +33,8 @@ "enabled": true, // enable CDR client functionality "cdr_in_dir": "/tmp/cgrates/cdrc2/in", // absolute path towards the directory where the CDRs are stored "cdr_out_dir": "/tmp/cgrates/cdrc2/out", // absolute path towards the directory where processed CDRs will be moved + "data_usage_multiply_factor": 0.000976563, + "run_delay": 1, "cdr_source_id": "csv2", // free form field, tag identifying the source of the CDRs within CDRS database "cdr_fields":[ // import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value {"cdr_field_id": "tor", "value": "~7:s/^(voice|data|sms)$/*$1/"}, diff --git a/config/cfg_data2.json b/config/cfg_data2.json new file mode 100644 index 000000000..51f8327de --- /dev/null +++ b/config/cfg_data2.json @@ -0,0 +1,30 @@ +{ + +"cdrc": { + "CDRC-CSV2": { + "enabled": true, // enable CDR client functionality + "cdr_in_dir": "/tmp/cgrates/cdrc2/in", // absolute path towards the directory where the CDRs are stored + "cdr_out_dir": "/tmp/cgrates/cdrc2/out", // absolute path towards the directory where processed CDRs will be moved + "data_usage_multiply_factor": 0.000976563, + "cdr_source_id": "csv2", // free form field, tag identifying the source of the CDRs within CDRS database + "cdr_fields":[ // import template, tag will match internally CDR field, in case of .csv value will be represented by index of the field value + {"cdr_field_id": "tor", "value": "~7:s/^(voice|data|sms)$/*$1/"}, + {"cdr_field_id": "answer_time", "value": "2"}, + ], + }, + "CDRC-CSV3": { + "enabled": true, // enable CDR client functionality + "cdr_in_dir": "/tmp/cgrates/cdrc3/in", // absolute path towards the directory where the CDRs are stored + "cdr_out_dir": "/tmp/cgrates/cdrc3/out", // absolute path towards the directory where processed CDRs will be moved + "cdr_source_id": "csv3", // free form field, tag identifying the source of the CDRs within CDRS database + }, +}, + +"sm_freeswitch": { + "enabled": true, // starts SessionManager service: + "connections":[ // instantiate connections to multiple FreeSWITCH servers + {"server": "2.3.4.5:8021", "password": "ClueCon", "reconnects": 5}, + ], +}, + +} \ No newline at end of file diff --git a/config/config_json_test.go b/config/config_json_test.go index 09c521eaf..3c606fedb 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -473,11 +473,13 @@ func TestNewCgrJsonCfgFromFile(t *testing.T) { Cdr_source_id: utils.StringPointer("csv1"), }, "CDRC-CSV2": &CdrcJsonCfg{ - Enabled: utils.BoolPointer(true), - Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc2/in"), - Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc2/out"), - Cdr_source_id: utils.StringPointer("csv2"), - Cdr_fields: &cdrFields, + Enabled: utils.BoolPointer(true), + Data_usage_multiply_factor: utils.Float64Pointer(0.000976563), + Run_delay: utils.IntPointer(1), + Cdr_in_dir: utils.StringPointer("/tmp/cgrates/cdrc2/in"), + Cdr_out_dir: utils.StringPointer("/tmp/cgrates/cdrc2/out"), + Cdr_source_id: utils.StringPointer("csv2"), + Cdr_fields: &cdrFields, }, } if cfg, err := cgrJsonCfg.CdrcJsonCfg(); err != nil { diff --git a/utils/rsrfield.go b/utils/rsrfield.go index eebaab164..1b34101d4 100644 --- a/utils/rsrfield.go +++ b/utils/rsrfield.go @@ -141,6 +141,14 @@ func ParseRSRFieldsFromSlice(flds []string) (RSRFields, error) { } +func ParseRSRFieldsMustCompile(fldsStr, sep string) RSRFields { + if flds, err := ParseRSRFields(fldsStr, sep); err != nil { + return nil + } else { + return flds + } +} + type RSRFields []*RSRField // Return first Id of the rsrFields, used in cdre