added balance tag for action triggers

also chenged the names of direction and destination params (prefixxed
with balance)
This commit is contained in:
Radu Ioan Fericean
2014-12-04 19:37:47 +02:00
parent dd5cf17d7b
commit 2dd3f6527d
21 changed files with 249 additions and 201 deletions

View File

@@ -607,24 +607,25 @@ func (self *SQLStorage) SetTPActionTriggers(tpid string, ats map[string][]*utils
}
for _, at := range aTriggers {
saved := tx.Save(TpActionTrigger{
Tpid: tpid,
Tag: atId,
BalanceType: at.BalanceType,
Direction: at.Direction,
ThresholdType: at.ThresholdType,
ThresholdValue: at.ThresholdValue,
Recurrent: at.Recurrent,
MinSleep: int64(at.MinSleep),
DestinationTag: at.DestinationId,
BalanceWeight: at.BalanceWeight,
BalanceExpiryTime: at.BalanceExpirationDate,
BalanceRatingSubject: at.BalanceRatingSubject,
BalanceCategory: at.BalanceCategory,
BalanceSharedGroup: at.BalanceSharedGroup,
MinQueuedItems: at.MinQueuedItems,
ActionsTag: at.ActionsId,
Weight: at.Weight,
CreatedAt: time.Now(),
Tpid: tpid,
Tag: atId,
ThresholdType: at.ThresholdType,
ThresholdValue: at.ThresholdValue,
Recurrent: at.Recurrent,
MinSleep: int64(at.MinSleep),
BalanceId: at.BalanceId,
BalanceType: at.BalanceType,
BalanceDirection: at.BalanceDirection,
BalanceDestinationTag: at.BalanceDestinationId,
BalanceWeight: at.BalanceWeight,
BalanceExpiryTime: at.BalanceExpirationDate,
BalanceRatingSubject: at.BalanceRatingSubject,
BalanceCategory: at.BalanceCategory,
BalanceSharedGroup: at.BalanceSharedGroup,
MinQueuedItems: at.MinQueuedItems,
ActionsTag: at.ActionsId,
Weight: at.Weight,
CreatedAt: time.Now(),
})
if saved.Error != nil {
tx.Rollback()
@@ -1420,13 +1421,14 @@ func (self *SQLStorage) GetTpActionTriggers(tpid, tag string) (map[string][]*uti
}
for _, tpAt := range tpActionTriggers {
at := &utils.TPActionTrigger{
BalanceType: tpAt.BalanceType,
Direction: tpAt.Direction,
ThresholdType: tpAt.ThresholdType,
ThresholdValue: tpAt.ThresholdValue,
Recurrent: tpAt.Recurrent,
MinSleep: time.Duration(tpAt.MinSleep),
DestinationId: tpAt.DestinationTag,
BalanceId: tpAt.BalanceId,
BalanceType: tpAt.BalanceType,
BalanceDirection: tpAt.BalanceDirection,
BalanceDestinationId: tpAt.BalanceDestinationTag,
BalanceWeight: tpAt.BalanceWeight,
BalanceExpirationDate: tpAt.BalanceExpiryTime,
BalanceRatingSubject: tpAt.BalanceRatingSubject,