From b28a02512cc237e9777ac8b5bc84e71465af45ea Mon Sep 17 00:00:00 2001 From: DanB Date: Thu, 6 Mar 2014 19:49:24 +0100 Subject: [PATCH] Adding runids in session manager config --- config/config.go | 8 +++++++- config/config_test.go | 2 ++ config/test_data.txt | 1 + data/conf/cgrates.cfg | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config/config.go b/config/config.go index ecfa3aac0..f035acd99 100644 --- a/config/config.go +++ b/config/config.go @@ -116,6 +116,7 @@ type CGRConfig struct { SMRaterReconnects int // Number of reconnect attempts to rater SMDebitInterval int // the period to be debited in advanced during a call (in seconds) SMMaxCallDuration time.Duration // The maximum duration of a call + SMRunIds []string // Identifiers of additional sessions control. SMReqTypeFields []string // Name of request type fields to be used during additional sessions control <""|*default|field_name>. SMDirectionFields []string // Name of direction fields to be used during additional sessions control <""|*default|field_name>. SMTenantFields []string // Name of tenant fields to be used during additional sessions control <""|*default|field_name>. @@ -233,6 +234,7 @@ func (self *CGRConfig) setDefaults() error { self.SMRaterReconnects = 3 self.SMDebitInterval = 10 self.SMMaxCallDuration = time.Duration(3) * time.Hour + self.SMRunIds = []string{} self.SMReqTypeFields = []string{} self.SMDirectionFields = []string{} self.SMTenantFields = []string{} @@ -554,7 +556,11 @@ func loadConfig(c *conf.ConfigFile) (*CGRConfig, error) { return nil, errParse } } - + if hasOpt = c.HasOption("session_manager", "run_ids"); hasOpt { + if cfg.SMRunIds, errParse = ConfigSlice(c, "session_manager", "run_ids"); errParse != nil { + return nil, errParse + } + } if hasOpt = c.HasOption("session_manager", "reqtype_fields"); hasOpt { if cfg.SMReqTypeFields, errParse = ConfigSlice(c, "session_manager", "reqtype_fields"); errParse != nil { return nil, errParse diff --git a/config/config_test.go b/config/config_test.go index 59be67355..7107beee8 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -123,6 +123,7 @@ func TestDefaults(t *testing.T) { eCfg.SMRaterReconnects = 3 eCfg.SMDebitInterval = 10 eCfg.SMMaxCallDuration = time.Duration(3) * time.Hour + eCfg.SMRunIds = []string{} eCfg.SMReqTypeFields = []string{} eCfg.SMDirectionFields = []string{} eCfg.SMTenantFields = []string{} @@ -259,6 +260,7 @@ func TestConfigFromFile(t *testing.T) { eCfg.SMRaterReconnects = 99 eCfg.SMDebitInterval = 99 eCfg.SMMaxCallDuration = time.Duration(99) * time.Second + eCfg.SMRunIds = []string{"test"} eCfg.SMReqTypeFields = []string{"test"} eCfg.SMDirectionFields = []string{"test"} eCfg.SMTenantFields = []string{"test"} diff --git a/config/test_data.txt b/config/test_data.txt index 6178b2097..222449d48 100644 --- a/config/test_data.txt +++ b/config/test_data.txt @@ -97,6 +97,7 @@ rater = test # Address where to reach the Rater. rater_reconnects = 99 # Number of reconnects to rater before giving up. debit_interval = 99 # Interval to perform debits on. max_call_duration = 99 # Maximum call duration a prepaid call can last +run_ids = test # Identifiers of additional sessions control. reqtype_fields = test # Name of request type fields to be used during additional sessions control <""|*default|field_name>. direction_fields = test # Name of direction fields to be used during additional sessions control <""|*default|field_name>. tenant_fields = test # Name of tenant fields to be used during additional sessions control <""|*default|field_name>. diff --git a/data/conf/cgrates.cfg b/data/conf/cgrates.cfg index d55cc8946..c41efc38c 100644 --- a/data/conf/cgrates.cfg +++ b/data/conf/cgrates.cfg @@ -99,6 +99,7 @@ # rater_reconnects = 3 # Number of reconnects to rater before giving up. # debit_interval = 10 # Interval to perform debits on. # max_call_duration = 3h # Maximum call duration a prepaid call can last +# run_ids = # Identifiers of additional sessions control. # reqtype_fields = # Name of request type fields to be used during additional sessions control <""|*default|field_name>. # direction_fields = # Name of direction fields to be used during additional sessions control <""|*default|field_name>. # tenant_fields = # Name of tenant fields to be used during additional sessions control <""|*default|field_name>.