diff --git a/config/config_defaults.go b/config/config_defaults.go index c7a326679..9e66aa404 100644 --- a/config/config_defaults.go +++ b/config/config_defaults.go @@ -135,7 +135,7 @@ const CGRATES_CFG_JSON = ` "pubsubs_conns": [], // address where to reach the pubusb service, empty to disable pubsub functionality: <""|*internal|x.y.z.y:1234> "users_conns": [], // address where to reach the user service, empty to disable user profile functionality: <""|*internal|x.y.z.y:1234> "aliases_conns": [], // address where to reach the aliases service, empty to disable aliases functionality: <""|*internal|x.y.z.y:1234> - "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality<""|*internal|x.y.z.y:1234> + "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> "online_cdr_exports":[], // list of CDRE profiles to use for real-time CDR exports }, @@ -306,6 +306,7 @@ const CGRATES_CFG_JSON = ` "cdrs_conns": [ {"address": "*internal"} // address where to reach CDR Server, empty to disable CDR capturing <*internal|x.y.z.y:1234> ], + "cdrstats_conns": [], // address where to reach the cdrstats service, empty to disable stats functionality: <""|*internal|x.y.z.y:1234> "create_cdr": false, // create CDR out of events and sends them to CDRS component "debit_interval": "10s", // interval to perform debits on. "min_call_duration": "0s", // only authorize calls with allowed duration higher than this diff --git a/config/config_json_test.go b/config/config_json_test.go index ae37a6e08..077096891 100644 --- a/config/config_json_test.go +++ b/config/config_json_test.go @@ -470,6 +470,7 @@ func TestSmKamJsonCfg(t *testing.T) { &HaPoolJsonCfg{ Address: utils.StringPointer(utils.MetaInternal), }}, + Cdrstats_conns: &[]*HaPoolJsonCfg{}, Create_cdr: utils.BoolPointer(false), Debit_interval: utils.StringPointer("10s"), Min_call_duration: utils.StringPointer("0s"), diff --git a/config/config_test.go b/config/config_test.go index 4259f352d..e28e12f12 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -434,15 +434,15 @@ func TestCgrCfgJSONDefaultsSMKamConfig(t *testing.T) { Enabled: false, RALsConns: []*HaPoolConfig{&HaPoolConfig{Address: "*internal"}}, CDRsConns: []*HaPoolConfig{&HaPoolConfig{Address: "*internal"}}, + CDRStatsConns: []*HaPoolConfig{}, CreateCdr: false, DebitInterval: 10 * time.Second, MinCallDuration: 0 * time.Second, MaxCallDuration: 3 * time.Hour, EvapiConns: []*KamConnConfig{&KamConnConfig{Address: "127.0.0.1:8448", Reconnects: 5}}, } - if !reflect.DeepEqual(cgrCfg.SmKamConfig, eSmKaCfg) { - t.Errorf("received: %+v, expecting: %+v", cgrCfg.CdreProfiles, eSmKaCfg) + t.Errorf("received: %+v, expecting: %+v", cgrCfg.SmKamConfig, eSmKaCfg) } } diff --git a/config/libconfig_json.go b/config/libconfig_json.go index 205162ba4..1ccfd0bef 100644 --- a/config/libconfig_json.go +++ b/config/libconfig_json.go @@ -275,6 +275,7 @@ type SmKamJsonCfg struct { Enabled *bool Rals_conns *[]*HaPoolJsonCfg Cdrs_conns *[]*HaPoolJsonCfg + Cdrstats_conns *[]*HaPoolJsonCfg Create_cdr *bool Debit_interval *string Min_call_duration *string diff --git a/config/smconfig.go b/config/smconfig.go index e29a0e3eb..95ba847be 100644 --- a/config/smconfig.go +++ b/config/smconfig.go @@ -317,6 +317,7 @@ type SmKamConfig struct { Enabled bool RALsConns []*HaPoolConfig CDRsConns []*HaPoolConfig + CDRStatsConns []*HaPoolConfig CreateCdr bool DebitInterval time.Duration MinCallDuration time.Duration @@ -346,6 +347,13 @@ func (self *SmKamConfig) loadFromJsonCfg(jsnCfg *SmKamJsonCfg) error { self.CDRsConns[idx].loadFromJsonCfg(jsnHaCfg) } } + if jsnCfg.Cdrstats_conns != nil { + self.CDRStatsConns = make([]*HaPoolConfig, len(*jsnCfg.Cdrstats_conns)) + for idx, jsnHaCfg := range *jsnCfg.Cdrstats_conns { + self.CDRStatsConns[idx] = NewDfltHaPoolConfig() + self.CDRStatsConns[idx].loadFromJsonCfg(jsnHaCfg) + } + } if jsnCfg.Create_cdr != nil { self.CreateCdr = *jsnCfg.Create_cdr }