mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Updating tutorial2 files with Chargers and Attributes for it
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
# TOPUP_RST_MONETARY_10 resets the <*default> <*monetary> balance to 10 units
|
||||
TOPUP_RST_MONETARY_10,*topup_reset,,,*default,*monetary,,,,,,,10,10,,,10
|
||||
|
||||
# TOPUP_RST_5M_VOICE resets the special <PER_CALL> *voice balance valid to destination <DST_10> with special rates <RPF_SPECIAL_BLC> to 10m
|
||||
TOPUP_RST_5M_VOICE,*topup_reset,,,PER_CALL,*voice,,DST_10,RPF_SPECIAL_BLC,,,,10m,10,,,10
|
||||
# TOPUP_RST_10M_VOICE resets the special <PER_CALL> *voice balance valid to destination <DST_10> with special rates <RPF_SPECIAL_BLC> to 10m
|
||||
TOPUP_RST_10M_VOICE,*topup_reset,,,PER_CALL,*voice,,DST_10,RPF_SPECIAL_BLC,,,,10m,10,,,10
|
||||
|
||||
# TOPUP_RST_10M_VOICE resets *voice balance <FREE_MINS> with 0 costs rounded up to minute to 5m and priority 20
|
||||
TOPUP_RST_10M_VOICE,*topup_reset,,,FREE_MINS,*voice,,,*zero1m,,,,5m,20,,,10
|
||||
# TOPUP_RST_5M_VOICE resets *voice balance <FREE_MINS> with 0 costs rounded up to minute to 5m and priority 20
|
||||
TOPUP_RST_5M_VOICE,*topup_reset,,,FREE_MINS,*voice,,,*zero1m,,,,5m,20,,,10
|
||||
|
||||
# TOPUP_RST_100_SMS resets the <FREE_SMSes> *sms balance to 100 units and priority 20 in balance chain
|
||||
TOPUP_RST_100_SMS,*topup_reset,,,FREE_SMSes,*sms,,,,,,,100,20,,,10
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
# Tenant,ID,Contexts,FilterIDs,ActivationInterval,AttributeFilterIDs,Path,Type,Value,Blocker,Weight
|
||||
|
||||
# ATTR_CRG_SUPPLIER1 replaces Category->supplier1 and RequestType->*constant for *sessions and *cdrs events
|
||||
cgrates.org,ATTR_CRG_SUPPLIER1,*sessions;*cdrs,,,,*req.Category,*constant,supplier1,false,0
|
||||
# CRG_RESELLER1 replaces Category->reseller1 and RequestType->*rated for *sessions and *cdrs events
|
||||
cgrates.org,ATTR_CRG_SUPPLIER1,*sessions;*cdrs,,,,*req.Category,*constant,reseller1,false,0
|
||||
cgrates.org,ATTR_CRG_SUPPLIER1,,,,,*req.RequestType,*constant,*rated,,
|
||||
|
||||
# ATTR_1001_AUTH returns the Password value for the account 1001 in context <auth>
|
||||
|
||||
|
@@ -3,6 +3,6 @@
|
||||
# CGR_DEFAULT is the default charger for events
|
||||
cgrates.org,CGR_DEFAULT,,,*default,*none,0
|
||||
|
||||
# CGR_SUPPLIER1 creates an additional CDR for calculating supplier costs
|
||||
# uses ATTR_CRG_SUPPLIER1 to replace Category and RequestType in events
|
||||
cgrates.org,CRG_SUPPPLIER1,,,SUPPLIER1,ATTR_CRG_SUPPLIER1,0
|
||||
# CGR_RESELLER1 creates an additional CDR for calculating reseller costs
|
||||
# uses ATTR_CRG_RESELLER1 to replace Category and RequestType in events
|
||||
cgrates.org,CRG_RESELLER1,,,reseller1,ATTR_CRG_RESELLER1,1
|
||||
|
||||
|
@@ -9,4 +9,5 @@ DR_ANY_10C_CN,*any,RT_10C_CN,*up,4,,
|
||||
DR_ANY_1024_1,*any,RT_1024_1,*up,4,,
|
||||
DR_1002_10C1,DST_1002,RT_10C1,*up,4,,
|
||||
DR_10_20C1,DST_10,RT_20C1,*up,4,,
|
||||
DR_1CNT,*any,RT_1CNT,*up,4,,
|
||||
DR_1CNT,*any,RT_1CNT,*up,4,,
|
||||
DR_10CNT,*any,RT_10CNT,*up,4,,
|
||||
|
@@ -24,3 +24,6 @@ RT_20C1,0,0.2,1,1,0
|
||||
|
||||
# RT_1CNT charges 0.01 units of cost for each 1s of usage
|
||||
RT_1CNT,0,0.01,1s,1s,0
|
||||
|
||||
# RT_10CNT charges 0.1 units of cost for each call connected
|
||||
RT_10CNT,0.1,0,1s,1s,0
|
||||
|
||||
|
@@ -11,4 +11,5 @@ RP_SPECIAL_BLC,DR_ANY_10C_CN,*any,10
|
||||
RP_DATA,DR_ANY_1024_1,*any,10
|
||||
RP_SMS,DR_1002_10C1,*any,10
|
||||
RP_SMS,DR_10_20C1,*any,10
|
||||
RP_1CNT,DR_1CNT,*any,0
|
||||
RP_1CNT,DR_1CNT,*any,0
|
||||
RP_10CNT,DR_10CNT,*any,0
|
||||
|
@@ -4,4 +4,6 @@ cgrates.org,call,1001,2019-03-01T00:00:00Z,RP_1001,*any
|
||||
cgrates.org,call,RPF_SPECIAL_BLC,2019-03-01T00:00:00Z,RP_SPECIAL_BLC,
|
||||
cgrates.org,data,*any,2019-03-01T00:00:00Z,RP_DATA,
|
||||
cgrates.org,sms,*any,2019-03-01T00:00:00Z,RP_SMS,
|
||||
cgrates.org,supplier1,*any,2019-03-01T00:00:00Z,RP_1CNT,
|
||||
|
||||
# reseller1 will pay 0.1 per call, independent of duration
|
||||
cgrates.org,reseller1,*any,2019-03-01T00:00:00Z,RP_10CNT,
|
||||
|
||||
|
@@ -266,6 +266,32 @@ func testTutGetCost(t *testing.T) {
|
||||
} else if *rply.Cost != 0.1 {
|
||||
t.Errorf("Unexpected cost received: %f", *rply.Cost)
|
||||
}
|
||||
// reseller1 pricing for 1001->1002
|
||||
attrs = v1.AttrGetCost{
|
||||
Subject: "1001",
|
||||
Destination: "1002",
|
||||
AnswerTime: "*now",
|
||||
Usage: "45s",
|
||||
Category: "reseller1",
|
||||
}
|
||||
if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil {
|
||||
t.Error("Unexpected nil error received: ", err.Error())
|
||||
} else if *rply.Cost != 0.1 {
|
||||
t.Errorf("Unexpected cost received: %f", *rply.Cost)
|
||||
}
|
||||
// reseller1 pricing for 1001->1002 duration independent
|
||||
attrs = v1.AttrGetCost{
|
||||
Subject: "1001",
|
||||
Destination: "1002",
|
||||
AnswerTime: "*now",
|
||||
Usage: "10m45s",
|
||||
Category: "reseller1",
|
||||
}
|
||||
if err := tutRpc.Call(utils.APIerSv1GetCost, attrs, &rply); err != nil {
|
||||
t.Error("Unexpected nil error received: ", err.Error())
|
||||
} else if *rply.Cost != 0.1 {
|
||||
t.Errorf("Unexpected cost received: %f", *rply.Cost)
|
||||
}
|
||||
}
|
||||
|
||||
func testTutAccounts(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user