SessionS store_session_costs configuration option

This commit is contained in:
DanB
2019-03-21 13:58:53 +01:00
parent f1af76ed0b
commit b50e07e2a3
5 changed files with 8 additions and 0 deletions

View File

@@ -306,6 +306,7 @@ const CGRATES_CFG_JSON = `
"attributes_conns": [], // connections to AttributeS for altering event fields <""|*internal|127.0.0.1:2013>
"session_replication_conns": [], // replicate sessions towards these session services
"debit_interval": "0s", // interval to perform debits on.
"store_session_costs": true, // enable storing of the session costs within CDRs
"min_call_duration": "0s", // only authorize calls with allowed duration higher than this
"max_call_duration": "3h", // maximum call duration a prepaid call can last
"session_ttl": "0s", // time after a session with no updates is terminated, not defined by default

View File

@@ -482,6 +482,7 @@ func TestSmgJsonCfg(t *testing.T) {
Attributes_conns: &[]*HaPoolJsonCfg{},
Session_replication_conns: &[]*HaPoolJsonCfg{},
Debit_interval: utils.StringPointer("0s"),
Store_session_costs: utils.BoolPointer(true),
Min_call_duration: utils.StringPointer("0s"),
Max_call_duration: utils.StringPointer("3h"),
Session_ttl: utils.StringPointer("0s"),

View File

@@ -624,6 +624,7 @@ func TestCgrCfgJSONDefaultsSMGenericCfg(t *testing.T) {
AttrSConns: []*HaPoolConfig{},
SessionReplicationConns: []*HaPoolConfig{},
DebitInterval: 0 * time.Second,
StoreSCosts: true,
MinCallDuration: 0 * time.Second,
MaxCallDuration: 3 * time.Hour,
SessionTTL: 0 * time.Second,

View File

@@ -219,6 +219,7 @@ type SessionSJsonCfg struct {
Session_replication_conns *[]*HaPoolJsonCfg
Attributes_conns *[]*HaPoolJsonCfg
Debit_interval *string
Store_session_costs *bool
Min_call_duration *string
Max_call_duration *string
Session_ttl *string

View File

@@ -111,6 +111,7 @@ type SessionSCfg struct {
CDRsConns []*HaPoolConfig
SessionReplicationConns []*HaPoolConfig
DebitInterval time.Duration
StoreSCosts bool
MinCallDuration time.Duration
MaxCallDuration time.Duration
SessionTTL time.Duration
@@ -200,6 +201,9 @@ func (self *SessionSCfg) loadFromJsonCfg(jsnCfg *SessionSJsonCfg) (err error) {
return err
}
}
if jsnCfg.Store_session_costs != nil {
self.StoreSCosts = *jsnCfg.Store_session_costs
}
if jsnCfg.Min_call_duration != nil {
if self.MinCallDuration, err = utils.ParseDurationWithNanosecs(*jsnCfg.Min_call_duration); err != nil {
return err