DisconnectCause in CdrStat filters

This commit is contained in:
DanB
2015-05-15 09:44:14 +02:00
parent 24edc024f7
commit 537c8ec558
20 changed files with 315 additions and 282 deletions

View File

@@ -394,35 +394,38 @@ type TPCdrStats struct {
func (self *TPCdrStats) AsExportSlice() [][]string {
retSlice := make([][]string, len(self.CdrStats))
for idx, cdrStat := range self.CdrStats {
retSlice[idx] = []string{self.CdrStatsId, cdrStat.QueueLength, cdrStat.TimeWindow, cdrStat.Metrics, cdrStat.SetupInterval, cdrStat.TOR, cdrStat.CdrHost, cdrStat.CdrSource,
cdrStat.ReqType, cdrStat.Direction, cdrStat.Tenant, cdrStat.Category, cdrStat.Account, cdrStat.Subject, cdrStat.DestinationPrefix, cdrStat.UsageInterval, cdrStat.Supplier,
cdrStat.MediationRunIds, cdrStat.RatedAccount, cdrStat.RatedSubject, cdrStat.CostInterval, cdrStat.ActionTriggers}
retSlice[idx] = []string{self.CdrStatsId, cdrStat.QueueLength, cdrStat.TimeWindow, cdrStat.Metrics, cdrStat.SetupInterval, cdrStat.TORs, cdrStat.CdrHosts,
cdrStat.CdrSources, cdrStat.ReqTypes, cdrStat.Directions, cdrStat.Tenants, cdrStat.Categories, cdrStat.Accounts, cdrStat.Subjects, cdrStat.DestinationPrefixes,
cdrStat.UsageInterval, cdrStat.Suppliers, cdrStat.DisconnectCauses, cdrStat.MediationRunIds, cdrStat.RatedAccounts, cdrStat.RatedSubjects, cdrStat.CostInterval,
cdrStat.ActionTriggers}
}
return retSlice
}
type TPCdrStat struct {
QueueLength string
TimeWindow string
Metrics string
SetupInterval string
TOR string
CdrHost string
CdrSource string
ReqType string
Direction string
Tenant string
Category string
Account string
Subject string
DestinationPrefix string
UsageInterval string
Supplier string
MediationRunIds string
RatedAccount string
RatedSubject string
CostInterval string
ActionTriggers string
QueueLength string
TimeWindow string
Metrics string
SetupInterval string
TORs string
CdrHosts string
CdrSources string
ReqTypes string
Directions string
Tenants string
Categories string
Accounts string
Subjects string
DestinationPrefixes string
UsageInterval string
Suppliers string
DisconnectCauses string
MediationRunIds string
RatedAccounts string
RatedSubjects string
CostInterval string
ActionTriggers string
}
type TPDerivedChargers struct {

View File

@@ -274,56 +274,58 @@ func TestTPCdrStatsAsExportSlice(t *testing.T) {
CdrStatsId: "CDRST1",
CdrStats: []*TPCdrStat{
&TPCdrStat{
QueueLength: "5",
TimeWindow: "60m",
Metrics: "ASR;ACD",
SetupInterval: "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z",
TOR: "*voice",
CdrHost: "87.139.12.167",
CdrSource: "FS_JSON",
ReqType: META_RATED,
Direction: "*out",
Tenant: "cgrates.org",
Category: "call",
Account: "dan",
Subject: "dan",
DestinationPrefix: "49",
UsageInterval: "5m;10m",
Supplier: "supplier1",
MediationRunIds: "default",
RatedAccount: "rif",
RatedSubject: "rif",
CostInterval: "0;2",
ActionTriggers: "STANDARD_TRIGGERS"},
QueueLength: "5",
TimeWindow: "60m",
Metrics: "ASR;ACD",
SetupInterval: "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z",
TORs: "*voice",
CdrHosts: "87.139.12.167",
CdrSources: "FS_JSON",
ReqTypes: META_RATED,
Directions: "*out",
Tenants: "cgrates.org",
Categories: "call",
Accounts: "dan",
Subjects: "dan",
DestinationPrefixes: "49",
UsageInterval: "5m;10m",
Suppliers: "supplier1",
DisconnectCauses: "NORMAL_CLEARNING",
MediationRunIds: "default",
RatedAccounts: "rif",
RatedSubjects: "rif",
CostInterval: "0;2",
ActionTriggers: "STANDARD_TRIGGERS"},
&TPCdrStat{
QueueLength: "5",
TimeWindow: "60m",
Metrics: "ASR",
SetupInterval: "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z",
TOR: "*voice",
CdrHost: "87.139.12.167",
CdrSource: "FS_JSON",
ReqType: META_RATED,
Direction: "*out",
Tenant: "cgrates.org",
Category: "call",
Account: "dan",
Subject: "dan",
DestinationPrefix: "49",
UsageInterval: "5m;10m",
Supplier: "supplier1",
MediationRunIds: "default",
RatedAccount: "dan",
RatedSubject: "dan",
CostInterval: "0;2",
ActionTriggers: "STANDARD_TRIGGERS"},
QueueLength: "5",
TimeWindow: "60m",
Metrics: "ASR",
SetupInterval: "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z",
TORs: "*voice",
CdrHosts: "87.139.12.167",
CdrSources: "FS_JSON",
ReqTypes: META_RATED,
Directions: "*out",
Tenants: "cgrates.org",
Categories: "call",
Accounts: "dan",
Subjects: "dan",
DestinationPrefixes: "49",
UsageInterval: "5m;10m",
Suppliers: "supplier1",
DisconnectCauses: "NORMAL_CLEARNING",
MediationRunIds: "default",
RatedAccounts: "dan",
RatedSubjects: "dan",
CostInterval: "0;2",
ActionTriggers: "STANDARD_TRIGGERS"},
},
}
expectedSlc := [][]string{
[]string{"CDRST1", "5", "60m", "ASR;ACD", "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z", "*voice", "87.139.12.167", "FS_JSON", META_RATED, "*out", "cgrates.org", "call",
"dan", "dan", "49", "5m;10m", "supplier1", "default", "rif", "rif", "0;2", "STANDARD_TRIGGERS"},
"dan", "dan", "49", "5m;10m", "supplier1", "NORMAL_CLEARNING", "default", "rif", "rif", "0;2", "STANDARD_TRIGGERS"},
[]string{"CDRST1", "5", "60m", "ASR", "2014-07-29T15:00:00Z;2014-07-29T16:00:00Z", "*voice", "87.139.12.167", "FS_JSON", META_RATED, "*out", "cgrates.org", "call",
"dan", "dan", "49", "5m;10m", "supplier1", "default", "dan", "dan", "0;2", "STANDARD_TRIGGERS"},
"dan", "dan", "49", "5m;10m", "supplier1", "NORMAL_CLEARNING", "default", "dan", "dan", "0;2", "STANDARD_TRIGGERS"},
}
if slc := cdrStats.AsExportSlice(); !reflect.DeepEqual(expectedSlc, slc) {
t.Errorf("Expecting: %+v, received: %+v", expectedSlc, slc)

View File

@@ -73,7 +73,7 @@ const (
ACTION_TRIGGERS_NRCOLS = 19
ACCOUNT_ACTIONS_NRCOLS = 5
DERIVED_CHARGERS_NRCOLS = 19
CDR_STATS_NRCOLS = 22
CDR_STATS_NRCOLS = 23
ROUNDING_UP = "*up"
ROUNDING_MIDDLE = "*middle"
ROUNDING_DOWN = "*down"