mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
modified loader for recurrent flag
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#Tag,BalanceType,Direction,ThresholdType,ThresholdValue,DestinationTag,ActionsTag,Weight
|
||||
STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,,LOG_BALANCE,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,,LOG_BALANCE,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_counter,15,FS_USERS,LOG_BALANCE,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,,LOG_BALANCE,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,,LOG_BALANCE,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_counter,15,false,FS_USERS,LOG_BALANCE,10
|
||||
|
||||
|
@@ -32,11 +32,11 @@ type ActionTrigger struct {
|
||||
Direction string
|
||||
ThresholdType string //*min_counter, *max_counter, *min_balance, *max_balance
|
||||
ThresholdValue float64
|
||||
Recurrent bool // reset eexcuted flag each run
|
||||
DestinationId string
|
||||
Weight float64
|
||||
ActionsId string
|
||||
Executed bool
|
||||
Recurrent bool
|
||||
}
|
||||
|
||||
func (at *ActionTrigger) Execute(ub *Account) (err error) {
|
||||
|
||||
@@ -676,7 +676,11 @@ func (csvr *CSVReader) LoadActionTriggers() (err error) {
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not parse action trigger value: %v", err)
|
||||
}
|
||||
weight, err := strconv.ParseFloat(record[7], 64)
|
||||
recurrent, err := strconv.ParseBool(record[5])
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not parse action trigger recurrent flag: %v", err)
|
||||
}
|
||||
weight, err := strconv.ParseFloat(record[8], 64)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Could not parse action trigger weight: %v", err)
|
||||
}
|
||||
@@ -686,8 +690,9 @@ func (csvr *CSVReader) LoadActionTriggers() (err error) {
|
||||
Direction: record[2],
|
||||
ThresholdType: record[3],
|
||||
ThresholdValue: value,
|
||||
DestinationId: record[5],
|
||||
ActionsId: record[6],
|
||||
Recurrent: recurrent,
|
||||
DestinationId: record[6],
|
||||
ActionsId: record[7],
|
||||
Weight: weight,
|
||||
}
|
||||
csvr.actionsTriggers[tag] = append(csvr.actionsTriggers[tag], at)
|
||||
|
||||
@@ -158,11 +158,11 @@ TOPUP_SHARED10_AT,SE10,ASAP,10
|
||||
TOPUP_EMPTY_AT,EE0,ASAP,10
|
||||
`
|
||||
actionTriggers = `
|
||||
STANDARD_TRIGGER,*call_duration,*out,*min_counter,10,GERMANY_O2,SOME_1,10
|
||||
STANDARD_TRIGGER,*call_duration,*out,*max_balance,200,GERMANY,SOME_2,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,,LOG_WARNING,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,,LOG_WARNING,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,FS_USERS,LOG_WARNING,10
|
||||
STANDARD_TRIGGER,*call_duration,*out,*min_counter,10,false,GERMANY_O2,SOME_1,10
|
||||
STANDARD_TRIGGER,*call_duration,*out,*max_balance,200,false,GERMANY,SOME_2,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,,LOG_WARNING,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,,LOG_WARNING,10
|
||||
STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,false,FS_USERS,LOG_WARNING,10
|
||||
`
|
||||
accountActions = `
|
||||
vdf,minitsboy;a1;a2,*out,MORE_MINUTES,STANDARD_TRIGGER
|
||||
|
||||
@@ -529,6 +529,7 @@ func (dbr *DbReader) LoadActionTriggers() (err error) {
|
||||
DestinationId: apiAtr.DestinationId,
|
||||
Weight: apiAtr.Weight,
|
||||
ActionsId: apiAtr.ActionsId,
|
||||
Recurrent: apiAtr.Recurrent,
|
||||
}
|
||||
}
|
||||
dbr.actionsTriggers[key] = atrs
|
||||
|
||||
@@ -1137,7 +1137,8 @@ func (self *SQLStorage) GetTpActionTriggers(tpid, tag string) (map[string][]*uti
|
||||
for rows.Next() {
|
||||
var threshold, weight float64
|
||||
var tpid, tag, balances_type, direction, destinations_tag, actions_tag, thresholdType string
|
||||
if err := rows.Scan(&tpid, &tag, &balances_type, &direction, &thresholdType, &threshold, &destinations_tag, &actions_tag, &weight); err != nil {
|
||||
var recurrent bool
|
||||
if err := rows.Scan(&tpid, &tag, &balances_type, &direction, &thresholdType, &threshold, &recurrent, &destinations_tag, &actions_tag, &weight); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -245,6 +245,7 @@ type TPActionTrigger struct {
|
||||
Direction string // Traffic direction
|
||||
ThresholdType string // This threshold type
|
||||
ThresholdValue float64 // Threshold
|
||||
Recurrent bool // reset executed flag each run
|
||||
DestinationId string // Id of the destination profile
|
||||
ActionsId string // Actions which will execute on threshold reached
|
||||
Weight float64 // weight
|
||||
|
||||
@@ -56,7 +56,7 @@ const (
|
||||
SHARED_GROUPS_NRCOLS = 4
|
||||
ACTIONS_NRCOLS = 12
|
||||
ACTION_PLANS_NRCOLS = 4
|
||||
ACTION_TRIGGERS_NRCOLS = 8
|
||||
ACTION_TRIGGERS_NRCOLS = 9
|
||||
ACCOUNT_ACTIONS_NRCOLS = 5
|
||||
DERIVED_CHARGERS_NRCOLS = 16
|
||||
ROUNDING_UP = "*up"
|
||||
|
||||
Reference in New Issue
Block a user