cgr-loader information formated with tab for verbose mode, adding data/tariffplans/tutorial folder to use as common tutorial tariff plan data

This commit is contained in:
DanB
2014-08-02 22:24:39 +02:00
parent a48fa90dd8
commit 455379ef97
15 changed files with 149 additions and 24 deletions

View File

@@ -0,0 +1,6 @@
#Tenant,Account,Direction,ActionPlanTag,ActionTriggersTag
cgrates.org,1001,*out,PACKAGE_10_SHARED_A_5,STANDARD_TRIGGERS
cgrates.org,1002;1006,*out,PACKAGE_10,STANDARD_TRIGGERS
cgrates.org,1003,*out,PACKAGE_10,STANDARD_TRIGGERS
cgrates.org,1004,*out,PACKAGE_10,STANDARD_TRIGGERS
cgrates.org,1007,*out,USE_SHARED_A,STANDARD_TRIGGERS
1 #Tenant Account Direction ActionPlanTag ActionTriggersTag
2 cgrates.org 1001 *out PACKAGE_10_SHARED_A_5 STANDARD_TRIGGERS
3 cgrates.org 1002;1006 *out PACKAGE_10 STANDARD_TRIGGERS
4 cgrates.org 1003 *out PACKAGE_10 STANDARD_TRIGGERS
5 cgrates.org 1004 *out PACKAGE_10 STANDARD_TRIGGERS
6 cgrates.org 1007 *out USE_SHARED_A STANDARD_TRIGGERS

View File

@@ -0,0 +1,5 @@
#Tag,ActionsTag,TimingTag,Weight
PACKAGE_10,TOPUP_RST_10,ASAP,10
PACKAGE_10_SHARED_A_5,TOPUP_RST_5,ASAP,10
PACKAGE_10_SHARED_A_5,TOPUP_RST_SHARED_5,ASAP,10
USE_SHARED_A,SHARED_A_0,ASAP,10
1 #Tag ActionsTag TimingTag Weight
2 PACKAGE_10 TOPUP_RST_10 ASAP 10
3 PACKAGE_10_SHARED_A_5 TOPUP_RST_5 ASAP 10
4 PACKAGE_10_SHARED_A_5 TOPUP_RST_SHARED_5 ASAP 10
5 USE_SHARED_A SHARED_A_0 ASAP 10

View File

@@ -0,0 +1,9 @@
#Tag,BalanceTag,Direction,ThresholdType,ThresholdValue,Recurrent,MinSleep,BalanceDestinationTag,BalanceWeight,BalanceExpiryTime,BalanceRatingSubject,BalanceSharedGroup,StatsMinQueuedItems,ActionsTag,Weight
STANDARD_TRIGGERS,*monetary,*out,*min_balance,2,false,0,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,*monetary,*out,*max_balance,20,false,0,,,,,,,LOG_WARNING,10
STANDARD_TRIGGERS,*monetary,*out,*max_counter,5,false,0,FS_USERS,,,,,,LOG_WARNING,10
CDRST5_WARN,,,*min_asr,45,true,1m,,,,,,3,LOG_WARNING,10
CDRST5_WARN,,,*min_acd,10,true,1m,,,,,,5,LOG_WARNING,10
CDRST5_WARN,,,*max_acc,10,true,1m,,,,,,5,LOG_WARNING,10
CDRST6_WARN,,,*min_asr,30,true,0,,,,,,5,LOG_WARNING,10
CDRST6_WARN,,,*min_acd,3,true,0,,,,,,2,LOG_WARNING,10
1 #Tag BalanceTag Direction ThresholdType ThresholdValue Recurrent MinSleep BalanceDestinationTag BalanceWeight BalanceExpiryTime BalanceRatingSubject BalanceSharedGroup StatsMinQueuedItems ActionsTag Weight
2 STANDARD_TRIGGERS *monetary *out *min_balance 2 false 0 LOG_WARNING 10
3 STANDARD_TRIGGERS *monetary *out *max_balance 20 false 0 LOG_WARNING 10
4 STANDARD_TRIGGERS *monetary *out *max_counter 5 false 0 FS_USERS LOG_WARNING 10
5 CDRST5_WARN *min_asr 45 true 1m 3 LOG_WARNING 10
6 CDRST5_WARN *min_acd 10 true 1m 5 LOG_WARNING 10
7 CDRST5_WARN *max_acc 10 true 1m 5 LOG_WARNING 10
8 CDRST6_WARN *min_asr 30 true 0 5 LOG_WARNING 10
9 CDRST6_WARN *min_acd 3 true 0 2 LOG_WARNING 10

View File

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

View File

@@ -0,0 +1,6 @@
#Id,QueueLength,TimeWindow,Metrics,SetupInterval,TOR,CdrHost,CdrSource,ReqType,Direction,Tenant,Category,Account,Subject,DestinationPrefix,UsageInterval,MediationRunIds,RatedAccount,RatedSubject,CostInterval,Triggers
CDRST5,5,1m,ASR,,*voice,,,,*out,cgrates.org,call,1001,1001,,,default,,,,CDRST5_WARN
CDRST5,,,ACD,,,,,,,,,,,,,,,,,
CDRST5,,,ACC,,,,,,,,,,,,,,,,,
CDRST6,10,0,ASR,,,,,,,cgrates.org,,,,,,default,,,,CDRST6_WARN
CDRST6,,,ACD,,,,,,,,,,,,,,,,,
1 #Id QueueLength TimeWindow Metrics SetupInterval TOR CdrHost CdrSource ReqType Direction Tenant Category Account Subject DestinationPrefix UsageInterval MediationRunIds RatedAccount RatedSubject CostInterval Triggers
2 CDRST5 5 1m ASR *voice *out cgrates.org call 1001 1001 default CDRST5_WARN
3 CDRST5 ACD
4 CDRST5 ACC
5 CDRST6 10 0 ASR cgrates.org default CDRST6_WARN
6 CDRST6 ACD

View File

@@ -0,0 +1,2 @@
#Direction,Tenant,Category,Account,Subject,RunId,RunFilter,ReqTypeField,DirectionField,TenantField,TorField,AccountField,SubjectField,DestinationField,SetupTimeField,AnswerTimeField,UsageField
*out,cgrates.org,call,1001,1001,fs_json_run,,^rated,*default,*default,*default,*default,^1002,*default,*default,*default,*default
1 #Direction Tenant Category Account Subject RunId RunFilter ReqTypeField DirectionField TenantField TorField AccountField SubjectField DestinationField SetupTimeField AnswerTimeField UsageField
2 *out cgrates.org call 1001 1001 fs_json_run ^rated *default *default *default *default ^1002 *default *default *default *default

View File

@@ -0,0 +1,8 @@
#Tag,DestinationsTag,RatesTag,RoundingMethod,RoundingDecimals
DR_1002_20CNT,DST_1002,RT_20CNT,*up,4
DR_1002_10CNT,DST_1002,RT_10CNT,*up,4
DR_1003_20CNT,DST_1003,RT_40CNT,*up,4
DR_1003_10CNT,DST_1003,RT_10CNT,*up,4
DR_FS_40CNT,DST_FS,RT_40CNT,*up,4
DR_FS_10CNT,DST_FS,RT_10CNT,*up,4
DR_SPECIAL_1002,DST_1002,RT_1CNT,*up,4
1 #Tag DestinationsTag RatesTag RoundingMethod RoundingDecimals
2 DR_1002_20CNT DST_1002 RT_20CNT *up 4
3 DR_1002_10CNT DST_1002 RT_10CNT *up 4
4 DR_1003_20CNT DST_1003 RT_40CNT *up 4
5 DR_1003_10CNT DST_1003 RT_10CNT *up 4
6 DR_FS_40CNT DST_FS RT_40CNT *up 4
7 DR_FS_10CNT DST_FS RT_10CNT *up 4
8 DR_SPECIAL_1002 DST_1002 RT_1CNT *up 4

View File

@@ -0,0 +1,4 @@
#Tag,Prefix
DST_1002,1002
DST_1003,1003
DST_FS,10
1 #Tag Prefix
2 DST_1002 1002
3 DST_1003 1003
4 DST_FS 10

View File

@@ -0,0 +1,39 @@
Tutorial FS_JSON
================
Scenario:
---------
- Create the necessary timings (always, asap, peak, offpeak).
- Configure 3 destinations (1002, 1003 and 10 used as catch all rule).
- As rating we configure the following:
- Rate id: *RT_10CNT* with connect fee of 20cents, 10cents per minute for the first 60s in 60s increments followed by 5cents per minute in 1s increments.
- Rate id: *RT_20CNT* with connect fee of 40cents, 20cents per minute for the first 60s in 60s increments, followed by 10 cents per minute charged in 1s increments.
- Rate id: *RT_40CNT* with connect fee of 80cents, 40cents per minute for the first 60s in 60s increments, follwed by 20cents per minute charged in 10s increments.
- Will charge by default *RT_40CNT* for all FreeSWITCH_ destinations during peak time (Monday-Friday 08:00-19:00) and *RT_10CNT* during offpeatimes (rest).
- Account 1001 will receive a special *deal* for 1002 and 1003 destinations during peak times with *RT_20CNT*, otherwise same as default rating.
- Create 5 accounts (equivalent of FreeSWITCH default test users - 1001, 1002, 1003, 1004, 1007).
- 1002, 1003, 1004 will receive 10units of *monetary balance.
- 1001 will receive 5 units of general *monetary and 5 units of shared balance in the shared group *SHARED_A*.
- 1007 will receive 0 units of shared balance in the shared group *SHARED_A*.
- Define the shared balance *SHARED_A* with debit policy *highest.
- For each balance created, attach 3 triggers to control the balance: log on balance=2, log on balance=20, log on 5 mins talked towards 10xx destination.
- Add 2 CDRStats Queue configurations:
- CDRStatsQueueId: *CDRST5* with a QueueLength of 5 CDRs and a TimeWindow of 1 minute monitoring ASR, ACD and ACC for CDRs with filters on TOR=*voice, Direction=*out, Tenant=cgrates.org, Category=call, Account=1001, Subject=1001 and MediationRunId=default. To this queue we attach ActionTriggers profile named CDRST5_WARN
- CDRStatsQueueId: *CDRST6* with a QueueLength of 10 CDRs and no TimeWindow gathering ASR and ACD metrics with CDR filters on Tenant=cgrates.org and MediationRunId=default. To this queue we attach an ActionTrigger profile named CDRST6_WARN.
- ActionTrigger: *CDRST5_WARN* with thresholds explained bellow and having as action the *log on syslog
- Threshold on *min_asr of 45, configured as recurrent with a sleep time of 1 minute and a minimum of 3 items in the stats queue.
- Threshold on *min_acd of 10, configured as recurrent with a sleep time of 1 minute and a minimum of 5 items in the stats queue.
- Threshold on *max_acc of 10, configured as recurrent with a sleep time of 1 minute and a minimum of 5 items in the stats queue.
- ActionTrigger: *CDRST6_WARN* with thresholds explained bellow and having as action the *log on syslog
- Threshold on *min_asr of 30, configured as recurrent without sleep time and a minimum of 5 items in the stats queue.
- Threshold on *min_acd of 3, configured as recurrent without sleep time and a minimum of 2 items in the stats queue.

View File

@@ -0,0 +1,8 @@
#Tag,ConnectFee,Rate,RateUnit,RateIncrement,GroupIntervalStart
RT_10CNT,0.2,0.1,60s,60s,0s
RT_10CNT,0,0.05,60s,1s,60s
RT_20CNT,0.4,0.2,60s,60s,0s
RT_20CNT,0,0.1,60s,1s,60s
RT_40CNT,0.8,0.4,60s,30s,0s
RT_40CNT,0,0.2,60s,10s,60s
RT_1CNT,0,0.01,60s,60s,0s
1 #Tag ConnectFee Rate RateUnit RateIncrement GroupIntervalStart
2 RT_10CNT 0.2 0.1 60s 60s 0s
3 RT_10CNT 0 0.05 60s 1s 60s
4 RT_20CNT 0.4 0.2 60s 60s 0s
5 RT_20CNT 0 0.1 60s 1s 60s
6 RT_40CNT 0.8 0.4 60s 30s 0s
7 RT_40CNT 0 0.2 60s 10s 60s
8 RT_1CNT 0 0.01 60s 60s 0s

View File

@@ -0,0 +1,18 @@
#Tag,DestinationRatesTag,TimingTag,Weight
RP_RETAIL1,DR_FS_40CNT,PEAK,10
RP_RETAIL1,DR_FS_10CNT,OFFPEAK_MORNING,10
RP_RETAIL1,DR_FS_10CNT,OFFPEAK_EVENING,10
RP_RETAIL1,DR_FS_10CNT,OFFPEAK_WEEKEND,10
RP_RETAIL2,DR_1002_20CNT,PEAK,10
RP_RETAIL2,DR_1003_20CNT,PEAK,10
RP_RETAIL2,DR_FS_40CNT,PEAK,10
RP_RETAIL2,DR_1002_10CNT,OFFPEAK_MORNING,10
RP_RETAIL2,DR_1002_10CNT,OFFPEAK_EVENING,10
RP_RETAIL2,DR_1002_10CNT,OFFPEAK_WEEKEND,10
RP_RETAIL2,DR_1003_10CNT,OFFPEAK_MORNING,10
RP_RETAIL2,DR_1003_10CNT,OFFPEAK_EVENING,10
RP_RETAIL2,DR_1003_10CNT,OFFPEAK_WEEKEND,10
RP_RETAIL2,DR_FS_10CNT,OFFPEAK_MORNING,10
RP_RETAIL2,DR_FS_10CNT,OFFPEAK_EVENING,10
RP_RETAIL2,DR_FS_10CNT,OFFPEAK_WEEKEND,10
RP_SPECIAL_1002,DR_SPECIAL_1002,ALWAYS,10
1 #Tag DestinationRatesTag TimingTag Weight
2 RP_RETAIL1 DR_FS_40CNT PEAK 10
3 RP_RETAIL1 DR_FS_10CNT OFFPEAK_MORNING 10
4 RP_RETAIL1 DR_FS_10CNT OFFPEAK_EVENING 10
5 RP_RETAIL1 DR_FS_10CNT OFFPEAK_WEEKEND 10
6 RP_RETAIL2 DR_1002_20CNT PEAK 10
7 RP_RETAIL2 DR_1003_20CNT PEAK 10
8 RP_RETAIL2 DR_FS_40CNT PEAK 10
9 RP_RETAIL2 DR_1002_10CNT OFFPEAK_MORNING 10
10 RP_RETAIL2 DR_1002_10CNT OFFPEAK_EVENING 10
11 RP_RETAIL2 DR_1002_10CNT OFFPEAK_WEEKEND 10
12 RP_RETAIL2 DR_1003_10CNT OFFPEAK_MORNING 10
13 RP_RETAIL2 DR_1003_10CNT OFFPEAK_EVENING 10
14 RP_RETAIL2 DR_1003_10CNT OFFPEAK_WEEKEND 10
15 RP_RETAIL2 DR_FS_10CNT OFFPEAK_MORNING 10
16 RP_RETAIL2 DR_FS_10CNT OFFPEAK_EVENING 10
17 RP_RETAIL2 DR_FS_10CNT OFFPEAK_WEEKEND 10
18 RP_SPECIAL_1002 DR_SPECIAL_1002 ALWAYS 10

View File

@@ -0,0 +1,4 @@
#Direction,Tenant,Category,Subject,ActivationTime,RatingPlanId,RatesFallbackSubject
*out,cgrates.org,call,*any,2014-01-14T00:00:00Z,RP_RETAIL1,
*out,cgrates.org,call,1001;1006,2014-01-14T00:00:00Z,RP_RETAIL2,
*out,cgrates.org,call,SPECIAL_1002,2014-01-14T00:00:00Z,RP_SPECIAL_1002,
1 #Direction Tenant Category Subject ActivationTime RatingPlanId RatesFallbackSubject
2 *out cgrates.org call *any 2014-01-14T00:00:00Z RP_RETAIL1
3 *out cgrates.org call 1001;1006 2014-01-14T00:00:00Z RP_RETAIL2
4 *out cgrates.org call SPECIAL_1002 2014-01-14T00:00:00Z RP_SPECIAL_1002

View File

@@ -0,0 +1,2 @@
#Id,Account,Strategy,RatingSubject
SHARED_A,*any,*highest,
1 #Id Account Strategy RatingSubject
2 SHARED_A *any *highest

View File

@@ -0,0 +1,7 @@
#Tag,Years,Months,MonthDays,WeekDays,Time
ALWAYS,*any,*any,*any,*any,00:00:00
ASAP,*any,*any,*any,*any,*asap
PEAK,*any,*any,*any,1;2;3;4;5,08:00:00
OFFPEAK_MORNING,*any,*any,*any,1,00:00:00
OFFPEAK_EVENING,*any,*any,*any,1;2;3;4;5,19:00:00
OFFPEAK_WEEKEND,*any,*any,*any,6;7,00:00:00
1 #Tag Years Months MonthDays WeekDays Time
2 ALWAYS *any *any *any *any 00:00:00
3 ASAP *any *any *any *any *asap
4 PEAK *any *any *any 1;2;3;4;5 08:00:00
5 OFFPEAK_MORNING *any *any *any 1 00:00:00
6 OFFPEAK_EVENING *any *any *any 1;2;3;4;5 19:00:00
7 OFFPEAK_WEEKEND *any *any *any 6;7 00:00:00

View File

@@ -189,7 +189,7 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
dataStorage.(Storage).Flush()
}
if verbose {
log.Print("Destinations")
log.Print("Destinations:")
}
for _, d := range csvr.destinations {
err = dataStorage.SetDestination(d)
@@ -197,11 +197,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(d.Id, " : ", d.Prefixes)
log.Print("\t", d.Id, " : ", d.Prefixes)
}
}
if verbose {
log.Print("Rating plans")
log.Print("Rating Plans:")
}
for _, rp := range csvr.ratingPlans {
err = dataStorage.SetRatingPlan(rp)
@@ -209,11 +209,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(rp.Id)
log.Print("\t", rp.Id)
}
}
if verbose {
log.Print("Rating profiles")
log.Print("Rating Profiles:")
}
for _, rp := range csvr.ratingProfiles {
err = dataStorage.SetRatingProfile(rp)
@@ -221,11 +221,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(rp.Id)
log.Print("\t", rp.Id)
}
}
if verbose {
log.Print("Action plans")
log.Print("Action Plans:")
}
for k, ats := range csvr.actionsTimings {
err = accountingStorage.SetActionTimings(k, ats)
@@ -233,11 +233,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Println(k)
log.Println("\t", k)
}
}
if verbose {
log.Print("Shared groups")
log.Print("Shared Groups:")
}
for k, sg := range csvr.sharedGroups {
err = accountingStorage.SetSharedGroup(sg)
@@ -245,11 +245,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Println(k)
log.Println("\t", k)
}
}
if verbose {
log.Print("LCR Rules")
log.Print("LCR Rules:")
}
for k, lcr := range csvr.lcrs {
err = dataStorage.SetLCR(lcr)
@@ -257,11 +257,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Println(k)
log.Println("\t", k)
}
}
if verbose {
log.Print("Actions")
log.Print("Actions:")
}
for k, as := range csvr.actions {
err = accountingStorage.SetActions(k, as)
@@ -269,11 +269,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Println(k)
log.Println("\t", k)
}
}
if verbose {
log.Print("Account actions")
log.Print("Account Actions:")
}
for _, ub := range csvr.accountActions {
err = accountingStorage.SetAccount(ub)
@@ -281,11 +281,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Println(ub.Id)
log.Println("\t", ub.Id)
}
}
if verbose {
log.Print("Rating profile aliases")
log.Print("Rating Profile Aliases:")
}
if err := dataStorage.RemoveRpAliases(csvr.dirtyRpAliases); err != nil {
return err
@@ -296,11 +296,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(key)
log.Print("\t", key)
}
}
if verbose {
log.Print("Account aliases")
log.Print("Account Aliases:")
}
if err := accountingStorage.RemoveAccAliases(csvr.dirtyAccAliases); err != nil {
return err
@@ -311,11 +311,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(key)
log.Print("\t", key)
}
}
if verbose {
log.Print("Derived Chargers")
log.Print("Derived Chargers:")
}
for key, dcs := range csvr.derivedChargers {
err = accountingStorage.SetDerivedChargers(key, dcs)
@@ -323,11 +323,11 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(key)
log.Print("\t", key)
}
}
if verbose {
log.Print("CDR Stats Queues")
log.Print("CDR Stats Queues:")
}
for _, sq := range csvr.cdrStats {
err = dataStorage.SetCdrStats(sq)
@@ -335,7 +335,7 @@ func (csvr *CSVReader) WriteToDatabase(flush, verbose bool) (err error) {
return err
}
if verbose {
log.Print(sq.Id)
log.Print("\t", sq.Id)
}
}
return