From 98935b99b7f71f8a6fb259a018484eaa0fb4c512 Mon Sep 17 00:00:00 2001 From: DanB Date: Wed, 4 Feb 2015 15:06:54 +0100 Subject: [PATCH] Responder.TestGetDerivedMaxSessionTime fix --- config/config.go | 42 ++++++++-------------------------------- engine/responder_test.go | 2 -- 2 files changed, 8 insertions(+), 36 deletions(-) diff --git a/config/config.go b/config/config.go index 82b799884..1f9f133fb 100644 --- a/config/config.go +++ b/config/config.go @@ -78,6 +78,14 @@ func NewDefaultCGRConfig() (*CGRConfig, error) { dfltFsConnConfig = cfg.SmFsConfig.Connections[0] // We leave it crashing here on purpose if no Connection defaults defined dfltKamConnConfig = cfg.SmKamConfig.Connections[0] dfltOsipsConnConfig = cfg.SmOsipsConfig.Connections[0] + // Enforced parameters, here untill session manager will work with new configuration parameters, ToDo + cfg.SMEnabled = false + cfg.SMSwitchType = "freeswitch" + cfg.SMRater = utils.INTERNAL + cfg.SMReconnects = 3 + cfg.SMDebitInterval = 10 + cfg.SMMaxCallDuration = time.Duration(3) * time.Hour + cfg.SMMinCallDuration = time.Duration(5) * time.Second if err := cfg.checkConfigSanity(); err != nil { return nil, err } @@ -330,10 +338,6 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) error { if err != nil { return err } - jsnSMCfg, err := jsnCfg.SessionManagerJsonCfg() - if err != nil { - return err - } jsnFSCfg, err := jsnCfg.FSJsonCfg() if err != nil { return err @@ -555,36 +559,6 @@ func (self *CGRConfig) loadFromJsonCfg(jsnCfg *CgrJsonCfg) error { return err } } - if jsnSMCfg != nil { - if jsnSMCfg.Enabled != nil { - self.SMEnabled = *jsnSMCfg.Enabled - } - if jsnSMCfg.Switch_type != nil { - self.SMSwitchType = *jsnSMCfg.Switch_type - } - if jsnSMCfg.Rater != nil { - self.SMRater = *jsnSMCfg.Rater - } - if jsnSMCfg.Cdrs != nil { - self.SMCdrS = *jsnSMCfg.Cdrs - } - if jsnSMCfg.Reconnects != nil { - self.SMReconnects = *jsnSMCfg.Reconnects - } - if jsnSMCfg.Debit_interval != nil { - self.SMDebitInterval = *jsnSMCfg.Debit_interval - } - if jsnSMCfg.Max_call_duration != nil { - if self.SMMaxCallDuration, err = utils.ParseDurationWithSecs(*jsnSMCfg.Max_call_duration); err != nil { - return err - } - } - if jsnSMCfg.Min_call_duration != nil { - if self.SMMinCallDuration, err = utils.ParseDurationWithSecs(*jsnSMCfg.Min_call_duration); err != nil { - return err - } - } - } if jsnMediatorCfg != nil { if jsnMediatorCfg.Enabled != nil { self.MediatorEnabled = *jsnMediatorCfg.Enabled diff --git a/engine/responder_test.go b/engine/responder_test.go index 950e22bb0..f89433a76 100644 --- a/engine/responder_test.go +++ b/engine/responder_test.go @@ -54,7 +54,6 @@ func TestResponderGetDerivedChargers(t *testing.T) { } } -/* func TestGetDerivedMaxSessionTime(t *testing.T) { testTenant := "vdf" cdr := &utils.StoredCdr{CgrId: utils.Sha1("dsafdsaf", time.Date(2013, 11, 7, 8, 42, 26, 0, time.UTC).String()), OrderId: 123, TOR: utils.VOICE, AccId: "dsafdsaf", @@ -121,7 +120,6 @@ func TestGetDerivedMaxSessionTime(t *testing.T) { t.Error("Unexpected maxSessionTime received: ", maxSessionTime) } } -*/ func TestGetSessionRuns(t *testing.T) { testTenant := "vdf"