This commit is contained in:
DanB
2014-04-05 13:43:58 +02:00
5 changed files with 41 additions and 19 deletions

View File

@@ -58,8 +58,8 @@ const (
DEBIT = "*debit"
RESET_COUNTER = "*reset_counter"
RESET_COUNTERS = "*reset_counters"
ENABLE_USER = "*enable_user"
DISABLE_USER = "*disable_user"
ENABLE_ACCOUNT = "*enable_account"
DISABLE_ACCOUNT = "*disable_account"
CALL_URL = "*call_url"
CALL_URL_ASYNC = "*call_url_async"
MAIL_ASYNC = "*mail_async"
@@ -90,9 +90,9 @@ func getActionFunc(typ string) (actionTypeFunc, bool) {
return resetCounterAction, true
case RESET_COUNTERS:
return resetCountersAction, true
case ENABLE_USER:
case ENABLE_ACCOUNT:
return enableUserAction, true
case DISABLE_USER:
case DISABLE_ACCOUNT:
return disableUserAction, true
case CALL_URL:
return callUrl, true

View File

@@ -575,7 +575,7 @@ func TestMaxDebitZeroDefinedRate(t *testing.T) {
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.directvoip.co.uk",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
@@ -603,7 +603,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.directvoip.co.uk",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
@@ -613,7 +613,7 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
CallDuration: 0}
cc, err := cd1.MaxDebit()
if err != nil {
t.Error("Error maxdebiting: ", err)
t.Fatal("Error maxdebiting: ", err)
}
if cc.GetDuration() != 40*time.Second {
t.Error("Error obtaining max debit duration: ", cc.GetDuration())
@@ -623,7 +623,29 @@ func TestMaxDebitZeroDefinedRateOnlyMinutes(t *testing.T) {
}
}
/*********************************** BENCHMARKS ***************************************/
func TestMaxDebitConsumesMinutes(t *testing.T) {
ap, _ := accountingStorage.GetActionTimings("TOPUP10_AT")
for _, at := range ap {
at.Execute()
}
cd1 := &CallDescriptor{
Direction: "*out",
TOR: "call",
Tenant: "cgrates.org",
Subject: "12345",
Account: "12345",
Destination: "447956",
TimeStart: time.Date(2014, 3, 4, 6, 0, 0, 0, time.UTC),
TimeEnd: time.Date(2014, 3, 4, 6, 0, 5, 0, time.UTC),
LoopIndex: 0,
CallDuration: 0}
cd1.MaxDebit()
if cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value != 20 {
t.Error("Error using minutes: ", cd1.account.BalanceMap[MINUTES+OUTBOUND][0].Value)
}
}
/*************** BENCHMARKS ********************/
func BenchmarkStorageGetting(b *testing.B) {
b.StopTimer()
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)

View File

@@ -118,8 +118,8 @@ vdf,0,*out,fallback1,2013-11-18T13:45:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:46:00Z,G,fallback2
vdf,0,*out,fallback1,2013-11-18T13:47:00Z,G,fallback2
vdf,0,*out,fallback2,2013-11-18T13:45:00Z,R,rif
cgrates.directvoip.co.uk,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.directvoip.co.uk,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
cgrates.org,call,*out,*any,2013-01-06T00:00:00Z,RP_UK,
cgrates.org,call,*out,discounted_minutes,2013-01-06T00:00:00Z,RP_UK_Mobile_BIG5_PKG,
`
sharedGroups = `
SG1,*any,*lowest,
@@ -157,7 +157,7 @@ STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,FS_USERS,LOG_WARNING,10
`
accountActions = `
vdf,minitsboy;a1;a2,*out,MORE_MINUTES,STANDARD_TRIGGER
cgrates.directvoip.co.uk,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
cgrates.org,12345,*out,TOPUP10_AT,STANDARD_TRIGGERS
vdf,empty0,*out,TOPUP_SHARED0_AT,
vdf,empty10,*out,TOPUP_SHARED10_AT,
vdf,emptyX,*out,TOPUP_EMPTY_AT,