updated IT tests in agents

This commit is contained in:
adragusin
2020-01-21 17:54:43 +02:00
parent f9a79edfe3
commit 3074d01797
53 changed files with 2761 additions and 45 deletions

View File

@@ -68,7 +68,18 @@ var (
// Test start here
func TestDiamItTcp(t *testing.T) {
engine.KillEngine(0)
diamConfigDIR = "diamagent"
switch *dbType {
case utils.MetaInternal:
diamConfigDIR = "diamagent_internal"
case utils.MetaSQL:
diamConfigDIR = "diamagent_mysql"
case utils.MetaMongo:
diamConfigDIR = "diamagent_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsDiam {
t.Run(diamConfigDIR, stest)
}
@@ -93,7 +104,18 @@ func TestDiamItDispatcher(t *testing.T) {
func TestDiamItSctp(t *testing.T) {
engine.KillEngine(0)
diamConfigDIR = "diamsctpagent"
switch *dbType {
case utils.MetaInternal:
diamConfigDIR = "diamsctpagent_internal"
case utils.MetaSQL:
diamConfigDIR = "diamsctpagent_mysql"
case utils.MetaMongo:
diamConfigDIR = "diamsctpagent_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsDiam {
t.Run(diamConfigDIR, stest)
}
@@ -101,7 +123,18 @@ func TestDiamItSctp(t *testing.T) {
func TestDiamItMaxConn(t *testing.T) {
engine.KillEngine(0)
diamConfigDIR = "diamagentmaxconn"
switch *dbType {
case utils.MetaInternal:
diamConfigDIR = "diamagentmaxconn_internal"
case utils.MetaSQL:
diamConfigDIR = "diamagentmaxconn_mysql"
case utils.MetaMongo:
diamConfigDIR = "diamagentmaxconn_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsDiam[:7] {
t.Run(diamConfigDIR, stest)
}
@@ -111,7 +144,19 @@ func TestDiamItMaxConn(t *testing.T) {
func TestDiamItSessionDisconnect(t *testing.T) {
engine.KillEngine(0)
diamConfigDIR = "diamagent"
switch *dbType {
case utils.MetaInternal:
diamConfigDIR = "diamagent_internal"
case utils.MetaSQL:
diamConfigDIR = "diamagent_mysql"
case utils.MetaMongo:
diamConfigDIR = "diamagent_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
for _, stest := range sTestsDiam[:7] {
t.Run(diamConfigDIR, stest)
}

View File

@@ -46,54 +46,65 @@ var (
httpC *http.Client // so we can cache the connection
err error
isTls bool
sTestsHA = []func(t *testing.T){
testHAitInitCfg,
testHAitHttp,
testHAitResetDB,
testHAitStartEngine,
testHAitApierRpcConn,
testHAitTPFromFolder,
testHAitAuthDryRun,
testHAitAuth1001,
testHAitCDRmtcall,
testHAitCDRmtcall2,
testHAitTextPlain,
testHAitStopEngine,
}
)
var sTestsHA = []func(t *testing.T){
testHAitInitCfg,
testHAitHttp,
testHAitResetDB,
testHAitStartEngine,
testHAitApierRpcConn,
testHAitTPFromFolder,
testHAitAuthDryRun,
testHAitAuth1001,
testHAitCDRmtcall,
testHAitCDRmtcall2,
testHAitTextPlain,
testHAitStopEngine,
}
func TestHAit(t *testing.T) {
var configDir, configDirTls string
switch *dbType {
case utils.MetaInternal:
configDir = "httpagent_internal"
configDirTls = "httpagenttls_internal"
haCfgDIR = "httpagent_internal"
case utils.MetaSQL:
configDir = "httpagent_mysql"
configDirTls = "httpagenttls_mysql"
haCfgDIR = "httpagent_mysql"
case utils.MetaMongo:
configDir = "httpagent_mongo"
configDirTls = "httpagenttls_mongo"
haCfgDIR = "httpagent_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
if *encoding == utils.MetaGOB {
configDir += "_gob"
configDirTls += "_gob"
haCfgDIR += "_gob"
}
//Run the tests without Tls
isTls = false
haCfgDIR = configDir
for _, stest := range sTestsHA {
t.Run(haCfgDIR, stest)
}
}
func TestHAitTls(t *testing.T) {
switch *dbType {
case utils.MetaInternal:
haCfgDIR = "httpagenttls_internal"
case utils.MetaSQL:
haCfgDIR = "httpagenttls_mysql"
case utils.MetaMongo:
haCfgDIR = "httpagenttls_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
if *encoding == utils.MetaGOB {
haCfgDIR += "_gob"
}
//Run the tests with Tls
isTls = true
haCfgDIR = configDirTls
for _, stest := range sTestsHA {
t.Run(haCfgDIR, stest)
}
@@ -290,7 +301,7 @@ func testHAitCDRmtcall(t *testing.T) {
if cdrs[0].Usage != "3m5s" { // should be 1 but maxUsage returns rounded version
t.Errorf("Unexpected CDR Usage received, cdr: %s ", utils.ToJSON(cdrs[0]))
}
if cdrs[0].Cost != 0.2188 {
if utils.Round(cdrs[0].Cost, 4, utils.ROUNDING_MIDDLE) != 0.2188 { // sql have only 4 digits after decimal point
t.Errorf("Unexpected CDR Cost received, cdr: %+v ", cdrs[0].Cost)
}
if cdrs[0].OriginHost != "127.0.0.1" {

View File

@@ -60,9 +60,23 @@ var (
// Test start here
func TestRAit(t *testing.T) {
engine.KillEngine(0)
raonfigDIR = "radagent"
switch *dbType {
case utils.MetaInternal:
raonfigDIR = "radagent_internal"
case utils.MetaSQL:
raonfigDIR = "radagent_mysql"
case utils.MetaMongo:
raonfigDIR = "radagent_mongo"
case utils.MetaPostgres:
t.SkipNow()
default:
t.Fatal("Unknown Database type")
}
if *encoding == utils.MetaGOB {
raonfigDIR += "_gob"
}
for _, stest := range sTestsRadius {
t.Run(diamConfigDIR, stest)
t.Run(raonfigDIR, stest)
}
}
@@ -85,9 +99,6 @@ func TestRAitDispatcher(t *testing.T) {
func testRAitInitCfg(t *testing.T) {
raCfgPath = path.Join(*dataDir, "conf", "samples", raonfigDIR)
if *encoding == utils.MetaGOB {
raCfgPath = path.Join(*dataDir, "conf", "samples", raonfigDIR+"_gob")
}
// Init config first
var err error
raCfg, err = config.NewCGRConfigFromPath(raCfgPath)

View File

@@ -385,7 +385,7 @@ func main() {
}
return
}
if *pidFile != "" {
if *pidFile != utils.EmptyString {
writePid()
}
if *singlecpu {
@@ -395,16 +395,16 @@ func main() {
exitChan := make(chan bool)
go singnalHandler(exitChan)
if *memProfDir != "" {
if *memProfDir != utils.EmptyString {
go memProfiling(*memProfDir, *memProfInterval, *memProfNrFiles, exitChan)
}
cpuProfChanStop := make(chan struct{})
cpuProfChanDone := make(chan struct{})
if *cpuProfDir != "" {
if *cpuProfDir != utils.EmptyString {
go cpuProfiling(*cpuProfDir, cpuProfChanStop, cpuProfChanDone, exitChan)
}
if *scheduledShutdown != "" {
if *scheduledShutdown != utils.EmptyString {
shutdownDur, err := utils.ParseDurationWithNanosecs(*scheduledShutdown)
if err != nil {
log.Fatal(err)
@@ -422,7 +422,7 @@ func main() {
log.Fatalf("Could not parse config: <%s>", err.Error())
return
}
if *nodeID != "" {
if *nodeID != utils.EmptyString {
cfg.GeneralCfg().NodeID = *nodeID
}
config.SetCgrConfig(cfg) // Share the config object

View File

@@ -0,0 +1,66 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
"default_tenant": "cgrates.com",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"asr_template": "*asr",
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,125 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "data_init",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*initiate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_update_grp1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "_grp1"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*contant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
"continue": true,
},
{
"id": "data_update_grp2",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*constant", "value": "_grp2"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_terminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*terminate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*handler", "handler_id": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"},
],
},
]
}
}

View File

@@ -0,0 +1,28 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "simpa_event",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:4",
"*prefix:~*req.Service-Context-Id:simpa"],
"flags": ["*message", "*accounts", "*log"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*generic"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*value_exponent", "mandatory": true,
"value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"},
],
},
],
},
}

View File

@@ -0,0 +1,46 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "TestSessionDisconnect",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:testSessionDisconnect"],
"flags": ["*initiate", "*accounts","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*variable",
"value": "~*req.Origin-Host", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category",
"type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.Service-Information.IN-Information.Calling-Party-Address", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "DebitInterval", "field_id": "CGRDebitInterval",
"type": "*constant", "value": "1s"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*notempty:~*cgrep.Error:"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time",
"filters": ["*gte:~*cgrep.MaxUsage:0s"],
"type": "*variable", "value": "~*cgrep.MaxUsage{*duration_seconds&*round:0}", "mandatory": true},
],
},
],
},
}

View File

@@ -0,0 +1,67 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
"default_tenant": "cgrates.com",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
"db_type": "redis", // data_db type: <redis|mongo>
"db_port": 6379, // data_db port to reach the database
"db_name": "10", // data_db database name to connect to
},
"stor_db": {
"db_password": "CGRateS.org",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"asr_template": "*asr",
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,125 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "data_init",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*initiate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_update_grp1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "_grp1"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*contant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
"continue": true,
},
{
"id": "data_update_grp2",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*constant", "value": "_grp2"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_terminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*terminate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*handler", "handler_id": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"},
],
},
]
}
}

View File

@@ -0,0 +1,74 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "dryrun1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2002"},
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "1"},
{"tag": "CCTotalOctets1", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits1"},
{"tag": "GrantedUsage", "field_id": "Granted-Service-Unit.CC-Time", "type": "*sum",
"value": "~*cgreq.Val1;~*cgreq.Val2;~*cgreq.Val3"},
],
"continue": true,
},
{
"id": "dryrun2",
"filters": ["*rsr::~*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[0](!^$)"], // make sure the CC-Total-Octets was populated in the previous processor
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "2","new_branch": true},
{"tag": "CCTotalOctets2", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits2"},
],
},
],
},
}

View File

@@ -0,0 +1,37 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "message",
"filters": ["*string:~*vars.*cmd:CCR", "*prefix:~*req.Service-Context-Id:message",
"*string:~*req.CC-Request-Type:4"],
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "sms"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "mandatory": true,
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
],
},
}

View File

@@ -0,0 +1,28 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "simpa_event",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:4",
"*prefix:~*req.Service-Context-Id:simpa"],
"flags": ["*message", "*accounts", "*log"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*generic"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*value_exponent", "mandatory": true,
"value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"},
],
},
],
},
}

View File

@@ -0,0 +1,46 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "TestSessionDisconnect",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:testSessionDisconnect"],
"flags": ["*initiate", "*accounts","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*variable",
"value": "~*req.Origin-Host", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category",
"type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.Service-Information.IN-Information.Calling-Party-Address", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*variable",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "DebitInterval", "field_id": "CGRDebitInterval",
"type": "*constant", "value": "1s"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*notempty:~*cgrep.Error:"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time",
"filters": ["*gte:~*cgrep.MaxUsage:0s"],
"type": "*variable", "value": "~*cgrep.MaxUsage{*duration_seconds&*round:0}", "mandatory": true},
],
},
],
},
}

View File

@@ -0,0 +1,103 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*initiate", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceUpdate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*update", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceTerminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*cc_usage", "mandatory": true,
"value": "~*req.CC-Request-Number;~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/;5m"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
],
},
],
},
}

View File

@@ -0,0 +1,77 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"concurrent_requests": 0,
"sessions_conns": ["*localhost"],
"request_processors": [
{
"id": "maxconn",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[],
"reply_fields":[],
"continue": true,
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,77 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
"db_type": "redis", // data_db type: <redis|mongo>
"db_port": 6379, // data_db port to reach the database
"db_name": "10", // data_db database name to connect to
},
"stor_db": {
"db_password": "CGRateS.org",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"concurrent_requests": 0,
"sessions_conns": ["*localhost"],
"request_processors": [
{
"id": "maxconn",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[],
"reply_fields":[],
"continue": true,
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,69 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
"default_tenant": "cgrates.com",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"listen_net":"sctp",
"listen": "127.0.0.1:3869", // address where to listen for diameter requests <x.y.z.y:1234>
"sessions_conns": ["*localhost"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,74 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "dryrun1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2002"},
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "1"},
{"tag": "CCTotalOctets1", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits1"},
{"tag": "GrantedUsage", "field_id": "Granted-Service-Unit.CC-Time", "type": "*sum",
"value": "~*cgreq.Val1;~*cgreq.Val2;~*cgreq.Val3"},
],
"continue": true,
},
{
"id": "dryrun2",
"filters": ["*rsr::~*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[0](!^$)"], // make sure the CC-Total-Octets was populated in the previous processor
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "2","new_branch": true},
{"tag": "CCTotalOctets2", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits2"},
],
},
],
},
}

View File

@@ -0,0 +1,37 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "message",
"filters": ["*string:~*vars.*cmd:CCR", "*prefix:~*req.Service-Context-Id:message",
"*string:~*req.CC-Request-Type:4"],
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "sms"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "mandatory": true,
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
],
},
}

View File

@@ -0,0 +1,103 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*initiate", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceUpdate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*update", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceTerminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*cc_usage", "mandatory": true,
"value": "~*req.CC-Request-Number;~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/;5m"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
],
},
],
},
}

View File

@@ -0,0 +1,125 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "data_init",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*initiate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_update_grp1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "_grp1"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*contant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
"continue": true,
},
{
"id": "data_update_grp2",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*constant", "value": "_grp2"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_terminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*terminate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*handler", "handler_id": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"},
],
},
]
}
}

View File

@@ -0,0 +1,74 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "dryrun1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2002"},
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "1"},
{"tag": "CCTotalOctets1", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits1"},
{"tag": "GrantedUsage", "field_id": "Granted-Service-Unit.CC-Time", "type": "*sum",
"value": "~*cgreq.Val1;~*cgreq.Val2;~*cgreq.Val3"},
],
"continue": true,
},
{
"id": "dryrun2",
"filters": ["*rsr::~*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[0](!^$)"], // make sure the CC-Total-Octets was populated in the previous processor
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "2","new_branch": true},
{"tag": "CCTotalOctets2", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits2"},
],
},
],
},
}

View File

@@ -0,0 +1,37 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "message",
"filters": ["*string:~*vars.*cmd:CCR", "*prefix:~*req.Service-Context-Id:message",
"*string:~*req.CC-Request-Type:4"],
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "sms"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "mandatory": true,
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
],
},
}

View File

@@ -0,0 +1,28 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "simpa_event",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:4",
"*prefix:~*req.Service-Context-Id:simpa"],
"flags": ["*message", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*generic"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*value_exponent", "mandatory": true,
"value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"},
],
},
],
},
}

View File

@@ -0,0 +1,103 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*initiate", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceUpdate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*update", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceTerminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*cc_usage", "mandatory": true,
"value": "~*req.CC-Request-Number;~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/;5m"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
],
},
],
},
}

View File

@@ -0,0 +1,69 @@
{
// CGRateS Configuration file
//
// Used for cgradmin
// Starts rater, scheduler
"general": {
"log_level": 7,
"default_tenant": "cgrates.com",
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": { // database used to store runtime data (eg: accounts, cdr stats)
"db_type": "redis", // data_db type: <redis|mongo>
"db_port": 6379, // data_db port to reach the database
"db_name": "10", // data_db database name to connect to
},
"stor_db": {
"db_password": "CGRateS.org",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"chargers": {
"enabled": true,
"attributes_conns": ["*internal"],
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"chargers_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
},
"diameter_agent": {
"enabled": true,
"listen_net":"sctp",
"listen": "127.0.0.1:3869", // address where to listen for diameter requests <x.y.z.y:1234>
"sessions_conns": ["*localhost"],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,125 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "data_init",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*initiate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(1)]", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_update_grp1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group:1", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed", "value": "_grp1"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*contant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(1)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(1)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
"continue": true,
},
{
"id": "data_update_grp2",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*string:~*req.Multiple-Services-Credit-Control.Rating-Group[1]:2", "*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "InitialOriginID", "field_id": "InitialOriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*constant", "value": "_grp2"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*constant", "value": "2048"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets[~Rating-Group(2)];~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets[~Rating-Group(2)]"},
],
"reply_fields": [
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
{
"id": "data_terminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:gprs"],
"flags": ["*terminate", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*data"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginIDPrefix", "field_id": "OriginIDPrefix", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*constant", "value": "data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*handler", "handler_id": "*sum",
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Input-Octets;~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Output-Octets"},
],
},
]
}
}

View File

@@ -0,0 +1,74 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "dryrun1",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.Service-Context-Id:TestDiamItDryRun"],
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2002"},
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "1"},
{"tag": "CCTotalOctets1", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits1"},
{"tag": "GrantedUsage", "field_id": "Granted-Service-Unit.CC-Time", "type": "*sum",
"value": "~*cgreq.Val1;~*cgreq.Val2;~*cgreq.Val3"},
],
"continue": true,
},
{
"id": "dryrun2",
"filters": ["*rsr::~*rep.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[0](!^$)"], // make sure the CC-Total-Octets was populated in the previous processor
"flags": ["*dryrun"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "Val1", "field_id": "Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "field_id": "Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "field_id": "Val3", "type": "*constant", "value": "3"},
{"tag": "OptionalField", "field_id":"OptionalField", "type":"*composed",
"value":"~*req.Inexistent", "mandatory":false},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType",
"type": "*constant", "value": "*prepaid"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "UsedUnits1", "field_id": "UsedUnits1", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(1)]"},
{"tag": "UsedUnits2", "field_id": "UsedUnits2", "type": "*composed", "mandatory": true,
"value": "~*req.Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets[~Rating-Group(2)]"},
],
"reply_fields":[
{"tag": "RatingGroup", "field_id": "Multiple-Services-Credit-Control.Rating-Group",
"type": "*constant", "value": "2","new_branch": true},
{"tag": "CCTotalOctets2", "field_id": "Multiple-Services-Credit-Control.Used-Service-Unit.CC-Total-Octets",
"type": "*variable", "value": "~*cgreq.UsedUnits2"},
],
},
],
},
}

View File

@@ -0,0 +1,37 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "message",
"filters": ["*string:~*vars.*cmd:CCR", "*prefix:~*req.Service-Context-Id:message",
"*string:~*req.CC-Request-Type:4"],
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*sms"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "sms"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed", "mandatory": true,
"value": "~*req.Service-Information.SMS-Information.Recipient-Address.Address-Data"},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
],
},
],
},
}

View File

@@ -0,0 +1,28 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "simpa_event",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:4",
"*prefix:~*req.Service-Context-Id:simpa"],
"flags": ["*message", "*accounts"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*generic"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*prepaid"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "generic"},
{"tag": "Account", "field_id": "Account", "type": "*composed", "mandatory": true,
"value": "~*req.Subscription-Id.Subscription-Id-Data[~Subscription-Id-Type(0)]"},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*value_exponent", "mandatory": true,
"value": "~*req.Requested-Service-Unit.CC-Money.Unit-Value.Value-Digits;~*req.Requested-Service-Unit.CC-Money.Unit-Value.Exponent"},
],
},
],
},
}

View File

@@ -0,0 +1,103 @@
{
"diameter_agent": {
"request_processors": [
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*initiate", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceUpdate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:2",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*update", "*accounts", "*attributes"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*composed",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
{"tag": "GrantedUnits", "field_id": "Granted-Service-Unit.CC-Time", "type": "*composed",
"value": "~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "VoiceTerminate",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:3",
"*prefix:~*req.Service-Context-Id:voice"],
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"request_fields":[
{"tag": "TOR", "field_id": "ToR", "type": "*constant", "value": "*voice"},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*remote_host",
"mandatory": true},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant", "value": "*attributes"},
{"tag": "Account", "field_id": "Account", "type": "*constant", "value": "*attributes"},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*cc_usage", "mandatory": true,
"value": "~*req.CC-Request-Number;~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/;5m"},
{"tag": "LastUsed", "field_id": "LastUsed", "type": "*composed",
"value": "~*req.Used-Service-Unit.CC-Time:s/(.*)/${1}s/", "mandatory": true},
{"tag": "SubscriberID", "field_id": "SubscriberId", "type": "*composed",
"value": "~*req.Subscription-Id.Subscription-Id-Data", "mandatory": true},
],
"reply_fields":[
{"tag": "ResultCode", "filters": ["*rsr::~*cgrep.Error(!^$)"],
"field_id": "Result-Code", "type": "*constant", "value": "5030", "blocker": true},
{"tag": "ResultCode", "field_id": "Result-Code", "type": "*constant", "value": "2001"},
],
},
],
},
}

View File

@@ -0,0 +1,160 @@
{
// CGRateS Configuration file
//
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
},
"resources": {
"enabled": true,
"store_interval": "-1",
},
"attributes": {
"enabled": true,
},
"suppliers": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"chargers_conns": ["*internal"],
"debit_interval": "10s",
},
"radius_agent": {
"enabled": true,
"sessions_conns": ["*localhost"],
"request_processors": [
{
"id": "KamailioAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*auth", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "KamailioAccountingStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*initiate", "*attributes", "*resources", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
{
"id": "KamailioAccountingStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*usage_difference",
"value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,168 @@
{
// CGRateS Configuration file
//
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"rpc_conns": {
"conn1": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2013", "transport":"*gob"}],
},
},
"data_db": {
"db_type": "*internal",
},
"stor_db": {
"db_type": "*internal",
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
},
"resources": {
"enabled": true,
"store_interval": "-1",
},
"attributes": {
"enabled": true,
},
"suppliers": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
"attributes_conns": ["conn1"],
"cdrs_conns": ["conn1"],
"rals_conns": ["conn1"],
"resources_conns": ["conn1"],
"chargers_conns": ["*internal"],
"debit_interval": "10s",
},
"radius_agent": {
"enabled": true,
"sessions_conns": ["conn1"],
"request_processors": [
{
"id": "KamailioAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*auth", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "KamailioAccountingStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*initiate", "*attributes", "*resources", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
{
"id": "KamailioAccountingStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*usage_difference",
"value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,159 @@
{
// CGRateS Configuration file
//
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
},
"resources": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"suppliers": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
"attributes_conns": ["*localhost"],
"cdrs_conns": ["*localhost"],
"rals_conns": ["*localhost"],
"resources_conns": ["*localhost"],
"chargers_conns": ["*internal"],
"debit_interval": "10s",
},
"radius_agent": {
"enabled": true,
"sessions_conns": ["*localhost"],
"request_processors": [
{
"id": "KamailioAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*auth", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "KamailioAccountingStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*initiate", "*attributes", "*resources", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
{
"id": "KamailioAccountingStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*usage_difference",
"value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -0,0 +1,166 @@
{
// CGRateS Configuration file
//
"general": {
"log_level": 7,
},
"listen": {
"rpc_json": ":2012", // RPC JSON listening address
"rpc_gob": ":2013", // RPC GOB listening address
"http": ":2080", // HTTP listening address
},
"rpc_conns": {
"conn1": {
"strategy": "*first",
"conns": [{"address": "127.0.0.1:2013", "transport":"*gob"}],
},
},
"data_db": {
"db_type": "redis",
"db_port": 6379,
"db_name": "10",
},
"stor_db": { // database used to store offline tariff plans and CDRs
"db_password": "CGRateS.org", // password to use when connecting to stordb
},
"rals": {
"enabled": true,
},
"schedulers": {
"enabled": true,
},
"cdrs": {
"enabled": true,
"rals_conns": ["*internal"],
},
"resources": {
"enabled": true,
},
"attributes": {
"enabled": true,
},
"suppliers": {
"enabled": true,
},
"chargers": {
"enabled": true,
},
"sessions": {
"enabled": true,
"attributes_conns": ["conn1"],
"cdrs_conns": ["conn1"],
"rals_conns": ["conn1"],
"resources_conns": ["conn1"],
"chargers_conns": ["*internal"],
"debit_interval": "10s",
},
"radius_agent": {
"enabled": true,
"sessions_conns": ["conn1"],
"request_processors": [
{
"id": "KamailioAuth",
"filters": ["*string:~*vars.*radReqType:*radAuth"],
"flags": ["*auth", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Event-Timestamp", "mandatory": true},
],
"reply_fields":[
{"tag": "MaxUsage", "field_id": "SIP-AVP", "type": "*composed",
"value": "session_max_time#;~*cgrep.MaxUsage{*duration_seconds}", "mandatory": true},
],
},
{
"id": "KamailioAccountingStart",
"filters": ["*string:~*req.Acct-Status-Type:Start"],
"flags": ["*initiate", "*attributes", "*resources", "*accounts"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
{
"id": "KamailioAccountingStop",
"filters": ["*string:~*req.Acct-Status-Type:Stop"],
"flags": ["*terminate", "*resources", "*accounts", "*cdrs"],
"request_fields":[
{"tag": "Category", "field_id": "Category", "type": "*constant", "value": "call"},
{"tag": "RequestType", "field_id": "RequestType", "type": "*constant",
"value": "*prepaid", "mandatory": true},
{"tag": "OriginID", "field_id": "OriginID", "type": "*composed",
"value": "~*req.Acct-Session-Id;-;~*req.Sip-From-Tag;-;~*req.Sip-To-Tag", "mandatory": true},
{"tag": "OriginHost", "field_id": "OriginHost", "type": "*composed",
"value": "~*req.NAS-IP-Address", "mandatory": true},
{"tag": "Account", "field_id": "Account", "type": "*composed",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Subject", "field_id": "Subject", "type": "*variable",
"value": "~*req.User-Name", "mandatory": true},
{"tag": "Destination", "field_id": "Destination", "type": "*composed",
"value": "~*req.Called-Station-Id", "mandatory": true},
{"tag": "SetupTime", "field_id": "SetupTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "AnswerTime", "field_id": "AnswerTime", "type": "*composed",
"value": "~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "Usage", "field_id": "Usage", "type": "*usage_difference",
"value": "~*req.Event-Timestamp;~*req.Ascend-User-Acct-Time", "mandatory": true},
{"tag": "RemoteAddr" , "field_id": "RemoteAddr", "type": "*remote_host"},
],
"reply_fields":[],
},
],
},
"apier": {
"scheduler_conns": ["*internal"],
},
}

View File

@@ -22,6 +22,9 @@ lds_internal=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*internal
gnr_internal=$?
echo 'go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*internal'
go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*internal
agts_internal=$?
# SQL
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*sql
@@ -41,6 +44,9 @@ lds_sql=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*sql
gnr_sql=$?
echo 'go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*sql'
go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*sql
agts_sql=$?
# Mongo
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*mongo
@@ -60,6 +66,9 @@ lds_mongo=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*mongo
gnr_mongo=$?
echo 'go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*mongo'
go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*mongo
agts_mongo=$?
# Postgres
echo 'go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/apier/v1 -tags=integration -dbtype=*postgres
@@ -79,6 +88,10 @@ lds_postgres=$?
echo 'go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/general_tests -tags=integration -dbtype=*postgres
gnr_postgres=$?
echo 'go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*postgres'
go test github.com/cgrates/cgrates/agents -tags=integration -dbtype=*postgres
agts_postgres=$?
echo 'go test github.com/cgrates/cgrates/cdrc -tags=integration'
go test github.com/cgrates/cgrates/cdrc -tags=integration
@@ -89,9 +102,7 @@ cfg=$?
#All
echo 'go test github.com/cgrates/cgrates/agents -tags=integration'
go test github.com/cgrates/cgrates/agents -tags=integration
agts=$?
echo 'go test github.com/cgrates/cgrates/sessions -tags=integration'
go test github.com/cgrates/cgrates/sessions -tags=integration
smg=$?