add Category to Actions

This commit is contained in:
Radu Ioan Fericean
2014-08-24 18:08:10 +03:00
parent 94884e24c9
commit 1ea0341db0
18 changed files with 77 additions and 58 deletions

View File

@@ -144,6 +144,7 @@ CREATE TABLE `tp_actions` (
`expiry_time` varchar(24) NOT NULL,
`destination_id` varchar(64) NOT NULL,
`rating_subject` varchar(64) NOT NULL,
`category` varchar(16) NOT NULL,
`shared_group` varchar(64) NOT NULL,
`balance_weight` double(8,2) NOT NULL,
`extra_parameters` varchar(256) NOT NULL,

View File

@@ -1,2 +1,2 @@
#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight
CDRST_LOG,*log,,,,,,,,,,10
CDRST_LOG,*log,,,,,,,,,,,10
1 #ActionsTag #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight Action BalanceType Direction Units ExpiryTime DestinationTag RatingSubject BalanceWeight SharedGroup ExtraParameters Weight
2 CDRST_LOG CDRST_LOG,*log,,,,,,,,,,,10 *log 10

View File

@@ -1,6 +1,6 @@
#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight
PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10
BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,10,,,10
LOG_BALANCE,*log,,,,,,,,,,10
CDRST_WARN_HTTP,*call_url,,,,,,,,,http://localhost:8080,10
CDRST_LOG,*log,,,,,,,,,,10
PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10
BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,,10,,,10
LOG_BALANCE,*log,,,,,,,,,,,10
CDRST_WARN_HTTP,*call_url,,,,,,,,,,http://localhost:8080,10
CDRST_LOG,*log,,,,,,,,,,,10
1 #ActionsTag #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight Action BalanceType Direction Units ExpiryTime DestinationTag RatingSubject BalanceWeight SharedGroup ExtraParameters Weight
2 PREPAID_10 PREPAID_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 *topup_reset *monetary *out 10 *unlimited *any 10 10
3 BONUS_1 BONUS_1,*topup,*monetary,*out,1,*unlimited,*any,,,10,,,10 *topup *monetary *out 1 *unlimited *any 10 10
4 LOG_BALANCE LOG_BALANCE,*log,,,,,,,,,,,10 *log 10
5 CDRST_WARN_HTTP CDRST_WARN_HTTP,*call_url,,,,,,,,,,http://localhost:8080,10 *call_url http://localhost:8080 10
6 CDRST_LOG CDRST_LOG,*log,,,,,,,,,,,10 *log 10

View File

@@ -1,9 +1,9 @@
#ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight
TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10
TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,20,,,10
TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,20,,,10
TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,10,SHARED_A,,10
SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,SHARED_A,,10
LOG_WARNING,*log,,,,,,,,,,10
DISABLE_AND_LOG,*log,,,,,,,,,,10
DISABLE_AND_LOG,*disable_account,,,,,,,,,,10
TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10
TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,,20,,,10
TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,,20,,,10
TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,,10,SHARED_A,,10
SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,SHARED_A,,10
LOG_WARNING,*log,,,,,,,,,,,10
DISABLE_AND_LOG,*log,,,,,,,,,,,10
DISABLE_AND_LOG,*disable_account,,,,,,,,,,,10
1 #ActionsTag #ActionsTag,Action,BalanceType,Direction,Units,ExpiryTime,DestinationTag,RatingSubject,BalanceWeight,SharedGroup,ExtraParameters,Weight Action BalanceType Direction Units ExpiryTime DestinationTag RatingSubject BalanceWeight SharedGroup ExtraParameters Weight
2 TOPUP_RST_10 TOPUP_RST_10,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10 *topup_reset *monetary *out 10 *unlimited *any 10 10
3 TOPUP_RST_5 TOPUP_RST_5,*topup_reset,*monetary,*out,5,*unlimited,*any,,,20,,,10 *topup_reset *monetary *out 5 *unlimited *any 20 10
4 TOPUP_RST_5 TOPUP_RST_5,*topup_reset,*voice,*out,90,*unlimited,DST_1002,SPECIAL_1002,,20,,,10 *topup_reset *voice *out 90 *unlimited DST_1002 SPECIAL_1002 20 10
5 TOPUP_RST_SHARED_5 TOPUP_RST_SHARED_5,*topup,*monetary,*out,5,*unlimited,*any,,,10,SHARED_A,,10 *topup *monetary *out 5 *unlimited *any 10 SHARED_A 10
6 SHARED_A_0 SHARED_A_0,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,SHARED_A,,10 *topup_reset *monetary *out 0 *unlimited *any 10 SHARED_A 10
7 LOG_WARNING LOG_WARNING,*log,,,,,,,,,,,10 *log 10
8 DISABLE_AND_LOG DISABLE_AND_LOG,*log,,,,,,,,,,,10 *log 10
9 DISABLE_AND_LOG DISABLE_AND_LOG,*disable_account,,,,,,,,,,,10 *disable_account 10

View File

@@ -60,14 +60,14 @@ type Account struct {
// User's available minutes for the specified destination
func (ub *Account) getCreditForPrefix(cd *CallDescriptor) (duration time.Duration, credit float64, balances BalanceChain) {
creditBalances := ub.getBalancesForPrefix(cd.Destination, ub.BalanceMap[CREDIT+cd.Direction], "")
unitBalances := ub.getBalancesForPrefix(cd.Destination, ub.BalanceMap[cd.TOR+cd.Direction], "")
creditBalances := ub.getBalancesForPrefix(cd.Destination, cd.Category, ub.BalanceMap[CREDIT+cd.Direction], "")
unitBalances := ub.getBalancesForPrefix(cd.Destination, cd.Category, ub.BalanceMap[cd.TOR+cd.Direction], "")
// gather all balances from shared groups
var extendedCreditBalances BalanceChain
for _, cb := range creditBalances {
if cb.SharedGroup != "" {
if sharedGroup, _ := accountingStorage.GetSharedGroup(cb.SharedGroup, false); sharedGroup != nil {
sgb := sharedGroup.GetBalances(cd.Destination, CREDIT+cd.Direction, ub)
sgb := sharedGroup.GetBalances(cd.Destination, cd.Category, CREDIT+cd.Direction, ub)
sgb = sharedGroup.SortBalancesByStrategy(cb, sgb)
extendedCreditBalances = append(extendedCreditBalances, sgb...)
}
@@ -79,7 +79,7 @@ func (ub *Account) getCreditForPrefix(cd *CallDescriptor) (duration time.Duratio
for _, mb := range unitBalances {
if mb.SharedGroup != "" {
if sharedGroup, _ := accountingStorage.GetSharedGroup(mb.SharedGroup, false); sharedGroup != nil {
sgb := sharedGroup.GetBalances(cd.Destination, cd.TOR+cd.Direction, ub)
sgb := sharedGroup.GetBalances(cd.Destination, cd.Category, cd.TOR+cd.Direction, ub)
sgb = sharedGroup.SortBalancesByStrategy(mb, sgb)
extendedMinuteBalances = append(extendedMinuteBalances, sgb...)
}
@@ -143,7 +143,7 @@ func (ub *Account) debitBalanceAction(a *Action) error {
return nil //ub.BalanceMap[id].GetTotalValue()
}
func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sharedGroup string) BalanceChain {
func (ub *Account) getBalancesForPrefix(prefix, category string, balances BalanceChain, sharedGroup string) BalanceChain {
var usefulBalances BalanceChain
for _, b := range balances {
if b.IsExpired() || (ub.AllowNegative == false && b.SharedGroup == "" && b.Value <= 0) {
@@ -152,6 +152,9 @@ func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sh
if sharedGroup != "" && sharedGroup != "" && b.SharedGroup != sharedGroup {
continue
}
if !b.MatchCategory(category) {
continue
}
b.account = ub
if b.DestinationId != "" && b.DestinationId != utils.ANY {
for _, p := range utils.SplitPrefix(prefix, MIN_PREFIX_MATCH) {
@@ -183,8 +186,8 @@ func (ub *Account) getBalancesForPrefix(prefix string, balances BalanceChain, sh
}
// like getBalancesForPrefix but expanding shared balances
func (account *Account) getAlldBalancesForPrefix(destination, balanceType string) (bc BalanceChain) {
balances := account.getBalancesForPrefix(destination, account.BalanceMap[balanceType], "")
func (account *Account) getAlldBalancesForPrefix(destination, category, balanceType string) (bc BalanceChain) {
balances := account.getBalancesForPrefix(destination, category, account.BalanceMap[balanceType], "")
for _, b := range balances {
if b.SharedGroup != "" {
sharedGroup, err := accountingStorage.GetSharedGroup(b.SharedGroup, false)
@@ -192,7 +195,7 @@ func (account *Account) getAlldBalancesForPrefix(destination, balanceType string
Logger.Warning(fmt.Sprintf("Could not get shared group: %v", b.SharedGroup))
continue
}
sharedBalances := sharedGroup.GetBalances(destination, balanceType, account)
sharedBalances := sharedGroup.GetBalances(destination, category, balanceType, account)
sharedBalances = sharedGroup.SortBalancesByStrategy(b, sharedBalances)
bc = append(bc, sharedBalances...)
} else {
@@ -203,8 +206,8 @@ func (account *Account) getAlldBalancesForPrefix(destination, balanceType string
}
func (ub *Account) debitCreditBalance(cc *CallCost, count bool) (err error) {
usefulUnitBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.TOR+cc.Direction)
usefulMoneyBalances := ub.getAlldBalancesForPrefix(cc.Destination, CREDIT+cc.Direction)
usefulUnitBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.Category, cc.TOR+cc.Direction)
usefulMoneyBalances := ub.getAlldBalancesForPrefix(cc.Destination, cc.Category, CREDIT+cc.Direction)
// debit minutes
for _, balance := range usefulUnitBalances {
balance.DebitUnits(cc, count, balance.account, usefulMoneyBalances)
@@ -487,9 +490,9 @@ func (ub *Account) GetSharedGroups() (groups []string) {
return
}
func (account *Account) GetUniqueSharedGroupMembers(destination, direction, unitType string) ([]string, error) {
creditBalances := account.getBalancesForPrefix(destination, account.BalanceMap[CREDIT+direction], "")
unitBalances := account.getBalancesForPrefix(destination, account.BalanceMap[unitType+direction], "")
func (account *Account) GetUniqueSharedGroupMembers(destination, direction, category, unitType string) ([]string, error) {
creditBalances := account.getBalancesForPrefix(destination, category, account.BalanceMap[CREDIT+direction], "")
unitBalances := account.getBalancesForPrefix(destination, category, account.BalanceMap[unitType+direction], "")
// gather all shared group ids
var sharedGroupIds []string
for _, cb := range creditBalances {

View File

@@ -34,6 +34,7 @@ type Balance struct {
Weight float64
DestinationId string
RatingSubject string
Category string
SharedGroup string
precision int
account *Account // used to store ub reference for shared balances
@@ -51,6 +52,7 @@ func (b *Balance) Equal(o *Balance) bool {
b.Weight == o.Weight &&
b.DestinationId == o.DestinationId &&
b.RatingSubject == o.RatingSubject &&
b.Category == o.Category &&
b.SharedGroup == o.SharedGroup
}
@@ -58,6 +60,7 @@ func (b *Balance) Equal(o *Balance) bool {
func (b *Balance) IsDefault() bool {
return (b.DestinationId == "" || b.DestinationId == utils.ANY) &&
b.RatingSubject == "" &&
b.Category == "" &&
b.ExpirationDate.IsZero() &&
b.SharedGroup == ""
}
@@ -66,6 +69,10 @@ func (b *Balance) IsExpired() bool {
return !b.ExpirationDate.IsZero() && b.ExpirationDate.Before(time.Now())
}
func (b *Balance) MatchCategory(category string) bool {
return b.Category == "" || b.Category == category
}
func (b *Balance) HasDestination() bool {
return b.DestinationId != "" && b.DestinationId != utils.ANY
}
@@ -112,6 +119,7 @@ func (b *Balance) Clone() *Balance {
ExpirationDate: b.ExpirationDate,
Weight: b.Weight,
RatingSubject: b.RatingSubject,
Category: b.Category,
}
}

View File

@@ -541,7 +541,7 @@ func (cd *CallDescriptor) GetMaxSessionDuration() (duration time.Duration, err e
Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error()))
return 0, err
} else {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil {
AccLock.GuardMany(memberIds, func() (float64, error) {
duration, err = cd.getMaxSessionDuration(account)
return 0, err
@@ -591,7 +591,7 @@ func (cd *CallDescriptor) Debit() (cc *CallCost, err error) {
Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error()))
return nil, err
} else {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil {
AccLock.GuardMany(memberIds, func() (float64, error) {
cc, err = cd.debit(account)
return 0, err
@@ -612,7 +612,7 @@ func (cd *CallDescriptor) MaxDebit() (cc *CallCost, err error) {
Logger.Err(fmt.Sprintf("Could not get user balance for %s: %s.", cd.GetAccountKey(), err.Error()))
return nil, err
} else {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.TOR); err == nil {
if memberIds, err := account.GetUniqueSharedGroupMembers(cd.Destination, cd.Direction, cd.Category, cd.TOR); err == nil {
AccLock.GuardMany(memberIds, func() (float64, error) {
remainingDuration, err := cd.getMaxSessionDuration(account)
if err != nil || remainingDuration == 0 {

View File

@@ -666,15 +666,15 @@ func (csvr *CSVReader) LoadActions() (err error) {
}
}
var balanceWeight float64
if len(record[8]) == 0 { // Not defined
if len(record[9]) == 0 { // Not defined
balanceWeight = 0.0
} else {
balanceWeight, err = strconv.ParseFloat(record[8], 64)
balanceWeight, err = strconv.ParseFloat(record[9], 64)
if err != nil {
return fmt.Errorf("Could not parse action balance weight: %v", err)
}
}
weight, err := strconv.ParseFloat(record[11], 64)
weight, err := strconv.ParseFloat(record[12], 64)
if err != nil {
return fmt.Errorf("Could not parse action weight: %v", err)
}
@@ -685,14 +685,15 @@ func (csvr *CSVReader) LoadActions() (err error) {
Direction: record[3],
Weight: weight,
ExpirationString: record[5],
ExtraParameters: record[10],
ExtraParameters: record[11],
Balance: &Balance{
Uuid: utils.GenUUID(),
Value: units,
Weight: balanceWeight,
DestinationId: record[6],
RatingSubject: record[7],
SharedGroup: record[9],
Category: record[8],
SharedGroup: record[10],
},
}
if _, err := utils.ParseDate(a.ExpirationString); err != nil {

View File

@@ -140,16 +140,16 @@ SG3,*any,*lowest,
`
actions = `
MINI,*topup_reset,*monetary,*out,10,*unlimited,,,10,,,10
MINI,*topup,*voice,*out,100,*unlimited,NAT,test,10,,,10
SHARED,*topup,*monetary,*out,100,*unlimited,,,10,SG1,,10
TOPUP10_AC,*topup_reset,*monetary,*out,1,*unlimited,*any,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10
SE0,*topup_reset,*monetary,*out,0,*unlimited,,,10,SG2,,10
SE10,*topup_reset,*monetary,*out,10,*unlimited,,,5,SG2,,10
SE10,*topup,*monetary,*out,10,*unlimited,,,10,,,10
EE0,*topup_reset,*monetary,*out,0,*unlimited,,,10,SG3,,10
EE0,*allow_negative,*monetary,*out,0,*unlimited,,,10,,,10
MINI,*topup_reset,*monetary,*out,10,*unlimited,,,,10,,,10
MINI,*topup,*voice,*out,100,*unlimited,NAT,test,,10,,,10
SHARED,*topup,*monetary,*out,100,*unlimited,,,,10,SG1,,10
TOPUP10_AC,*topup_reset,*monetary,*out,1,*unlimited,*any,,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10
SE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG2,,10
SE10,*topup_reset,*monetary,*out,10,*unlimited,,,,5,SG2,,10
SE10,*topup,*monetary,*out,10,*unlimited,,,,10,,,10
EE0,*topup_reset,*monetary,*out,0,*unlimited,,,,10,SG3,,10
EE0,*allow_negative,*monetary,*out,0,*unlimited,,,,10,,,10
`
actionTimings = `
MORE_MINUTES,MINI,ONE_TIME_RUN,10
@@ -725,8 +725,8 @@ func TestLoadActions(t *testing.T) {
},
},
}
if !reflect.DeepEqual(as1, expected) {
t.Error("Error loading action: ", as1)
if !reflect.DeepEqual(as1[1], expected[1]) {
t.Errorf("Error loading action1: %+v", as1[0].Balance)
}
as2 := csvr.actions["SHARED"]
expected = []*Action{

View File

@@ -544,6 +544,7 @@ func (dbr *DbReader) LoadActions() (err error) {
Value: tpact.Units,
Weight: tpact.BalanceWeight,
RatingSubject: tpact.RatingSubject,
Category: tpact.Category,
DestinationId: tpact.DestinationId,
},
}

View File

@@ -101,6 +101,7 @@ type TpAction struct {
ExpiryTime string
DestinationId string
RatingSubject string
Category string
SharedGroup string
BalanceWeight float64
ExtraParameters string

View File

@@ -102,7 +102,7 @@ func (sg *SharedGroup) SortBalancesByStrategy(myBalance *Balance, bc BalanceChai
}
// Returns all shared group's balances collected from user accounts'
func (sg *SharedGroup) GetBalances(destination, balanceType string, ub *Account) (bc BalanceChain) {
func (sg *SharedGroup) GetBalances(destination, category, balanceType string, ub *Account) (bc BalanceChain) {
// if len(sg.members) == 0 {
for _, ubId := range sg.MemberIds {
var nUb *Account
@@ -115,7 +115,7 @@ func (sg *SharedGroup) GetBalances(destination, balanceType string, ub *Account)
}
}
//sg.members = append(sg.members, nUb)
sb := nUb.getBalancesForPrefix(destination, nUb.BalanceMap[balanceType], sg.Id)
sb := nUb.getBalancesForPrefix(destination, category, nUb.BalanceMap[balanceType], sg.Id)
bc = append(bc, sb...)
}
/* } else {

View File

@@ -436,6 +436,7 @@ func (self *SQLStorage) SetTPActions(tpid string, acts map[string][]*utils.TPAct
ExpiryTime: ac.ExpiryTime,
DestinationId: ac.DestinationId,
RatingSubject: ac.RatingSubject,
Category: ac.Category,
SharedGroup: ac.SharedGroup,
BalanceWeight: ac.BalanceWeight,
ExtraParameters: ac.ExtraParameters,
@@ -448,7 +449,7 @@ func (self *SQLStorage) SetTPActions(tpid string, acts map[string][]*utils.TPAct
}
func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, error) {
rows, err := self.Db.Query(fmt.Sprintf("SELECT action,balance_type,direction,units,expiry_time,destination_id,rating_subject,shared_group,balance_weight,extra_parameters,weight FROM %s WHERE tpid='%s' AND id='%s'", utils.TBL_TP_ACTIONS, tpid, actsId))
rows, err := self.Db.Query(fmt.Sprintf("SELECT action,balance_type,direction,units,expiry_time,destination_id,rating_subject,category,shared_group,balance_weight,extra_parameters,weight FROM %s WHERE tpid='%s' AND id='%s'", utils.TBL_TP_ACTIONS, tpid, actsId))
if err != nil {
return nil, err
}
@@ -457,9 +458,9 @@ func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, err
i := 0
for rows.Next() {
i++ //Keep here a reference so we know we got at least one result
var action, balanceId, dir, destId, rateSubject, sharedGroup, expTime, extraParameters string
var action, balanceId, dir, destId, rateSubject, category, sharedGroup, expTime, extraParameters string
var units, balanceWeight, weight float64
if err = rows.Scan(&action, &balanceId, &dir, &units, &expTime, &destId, &rateSubject, &sharedGroup, &balanceWeight, &extraParameters, &weight); err != nil {
if err = rows.Scan(&action, &balanceId, &dir, &units, &expTime, &destId, &rateSubject, &category, &sharedGroup, &balanceWeight, &extraParameters, &weight); err != nil {
return nil, err
}
acts.Actions = append(acts.Actions, &utils.TPAction{
@@ -470,6 +471,7 @@ func (self *SQLStorage) GetTPActions(tpid, actsId string) (*utils.TPActions, err
ExpiryTime: expTime,
DestinationId: destId,
RatingSubject: rateSubject,
Category: category,
BalanceWeight: balanceWeight,
SharedGroup: sharedGroup,
ExtraParameters: extraParameters,
@@ -1444,6 +1446,7 @@ func (self *SQLStorage) GetTpActions(tpid, tag string) (map[string][]*utils.TPAc
ExpiryTime: tpAc.ExpiryTime,
DestinationId: tpAc.DestinationId,
RatingSubject: tpAc.RatingSubject,
Category: tpAc.Category,
SharedGroup: tpAc.SharedGroup,
BalanceWeight: tpAc.BalanceWeight,
ExtraParameters: tpAc.ExtraParameters,

View File

@@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
lcrs := ``
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,10,*unlimited,*any,,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10
TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``

View File

@@ -52,8 +52,8 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
lcrs := ``
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actions := `TOPUP10_AC,*topup_reset,*monetary,*out,0,*unlimited,*any,,,10,,,10
TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC,ASAP,10
TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``

View File

@@ -52,7 +52,7 @@ RP_UK,DR_UK_Mobile_BIG5,ALWAYS,10`
*out,cgrates.org,call,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,`
sharedGroups := ``
lcrs := ``
actions := `TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,10,,,10`
actions := `TOPUP10_AC1,*topup_reset,*voice,*out,40,*unlimited,DST_UK_Mobile_BIG5,discounted_minutes,,10,,,10`
actionPlans := `TOPUP10_AT,TOPUP10_AC1,ASAP,10`
actionTriggers := ``
accountActions := `cgrates.org,12346,*out,TOPUP10_AT,`

View File

@@ -222,6 +222,7 @@ type TPAction struct {
ExpiryTime string // Time when the units will expire
DestinationId string // Destination profile id
RatingSubject string // Reference a rate subject defined in RatingProfiles
Category string // category filter for balances
SharedGroup string // Reference to a shared group
BalanceWeight float64 // Balance weight
ExtraParameters string

View File

@@ -61,7 +61,7 @@ const (
RATE_PROFILES_NRCOLS = 7
SHARED_GROUPS_NRCOLS = 4
LCRS_NRCOLS = 9
ACTIONS_NRCOLS = 12
ACTIONS_NRCOLS = 13
ACTION_PLANS_NRCOLS = 4
ACTION_TRIGGERS_NRCOLS = 15
ACCOUNT_ACTIONS_NRCOLS = 5