Update config for diameter(sctp/dispatcher) with *fd flag

This commit is contained in:
TeoV
2020-11-05 16:52:06 +02:00
committed by Dan Christian Bogos
parent 102bdeb94a
commit f6b8bdc97f
5 changed files with 419 additions and 0 deletions

View File

@@ -189,6 +189,17 @@ func testDiamItResetAllDB(t *testing.T) {
if err := engine.InitStorDb(allCfg); err != nil {
t.Fatal(err)
}
cfgPath2 := path.Join(*dataDir, "conf", "samples", "dispatchers", "all2")
allCfg2, err := config.NewCGRConfigFromPath(cfgPath2)
if err != nil {
t.Fatal(err)
}
if err := engine.InitDataDb(allCfg2); err != nil {
t.Fatal(err)
}
if err := engine.InitStorDb(allCfg2); err != nil {
t.Fatal(err)
}
}
// Remove data in both rating and accounting db

View File

@@ -102,6 +102,105 @@
},
],
},
{
"id": "VoiceInitForceDuration",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:forceDurationVoice"
],
"flags": ["*initiate", "*fd", "*accounts", "*attributes"],
"request_fields":[
{
"tag": "ToR",
"path": "*cgreq.ToR",
"type": "*constant",
"value": "*voice"
},
{
"tag": "OriginID",
"path": "*cgreq.OriginID",
"type": "*variable",
"value": "~*req.Session-Id",
"mandatory": true
},
{
"tag": "OriginHost",
"path": "*cgreq.OriginHost",
"type": "*remote_host",
"mandatory": true
},
{
"tag": "RequestType",
"path": "*cgreq.RequestType",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Category",
"path": "*cgreq.Category",
"type": "*constant",
"value": "call"
},
{
"tag": "Account",
"path": "*cgreq.Account",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Destination",
"path": "*cgreq.Destination",
"type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
"mandatory": true
},
{
"tag": "AnswerTime",
"path": "*cgreq.AnswerTime",
"type": "*variable",
"value": "~*req.Event-Timestamp",
"mandatory": true
},
{
"tag": "Usage",
"path": "*cgreq.Usage",
"type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
"mandatory": true
},
{
"tag": "SubscriberID",
"path": "*cgreq.SubscriberId",
"type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data",
"mandatory": true
},
],
"reply_fields":[
{
"tag": "ResultCode",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Result-Code",
"type": "*constant",
"value": "5030",
"blocker": true
},
{
"tag": "ResultCode",
"path": "*rep.Result-Code",
"type": "*constant",
"value": "2001"
},
{
"tag": "GrantedUnits",
"path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable",
"value": "~*cgrep.MaxUsage{*duration_seconds}",
"mandatory": true
},
],
},
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",

View File

@@ -102,6 +102,105 @@
},
],
},
{
"id": "VoiceInitForceDuration",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:forceDurationVoice"
],
"flags": ["*initiate", "*fd", "*accounts", "*attributes"],
"request_fields":[
{
"tag": "ToR",
"path": "*cgreq.ToR",
"type": "*constant",
"value": "*voice"
},
{
"tag": "OriginID",
"path": "*cgreq.OriginID",
"type": "*variable",
"value": "~*req.Session-Id",
"mandatory": true
},
{
"tag": "OriginHost",
"path": "*cgreq.OriginHost",
"type": "*remote_host",
"mandatory": true
},
{
"tag": "RequestType",
"path": "*cgreq.RequestType",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Category",
"path": "*cgreq.Category",
"type": "*constant",
"value": "call"
},
{
"tag": "Account",
"path": "*cgreq.Account",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Destination",
"path": "*cgreq.Destination",
"type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
"mandatory": true
},
{
"tag": "AnswerTime",
"path": "*cgreq.AnswerTime",
"type": "*variable",
"value": "~*req.Event-Timestamp",
"mandatory": true
},
{
"tag": "Usage",
"path": "*cgreq.Usage",
"type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
"mandatory": true
},
{
"tag": "SubscriberID",
"path": "*cgreq.SubscriberId",
"type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data",
"mandatory": true
},
],
"reply_fields":[
{
"tag": "ResultCode",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Result-Code",
"type": "*constant",
"value": "5030",
"blocker": true
},
{
"tag": "ResultCode",
"path": "*rep.Result-Code",
"type": "*constant",
"value": "2001"
},
{
"tag": "GrantedUnits",
"path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable",
"value": "~*cgrep.MaxUsage{*duration_seconds}",
"mandatory": true
},
],
},
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",

View File

@@ -102,6 +102,105 @@
},
],
},
{
"id": "VoiceInitForceDuration",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:forceDurationVoice"
],
"flags": ["*initiate", "*fd", "*accounts", "*attributes"],
"request_fields":[
{
"tag": "ToR",
"path": "*cgreq.ToR",
"type": "*constant",
"value": "*voice"
},
{
"tag": "OriginID",
"path": "*cgreq.OriginID",
"type": "*variable",
"value": "~*req.Session-Id",
"mandatory": true
},
{
"tag": "OriginHost",
"path": "*cgreq.OriginHost",
"type": "*remote_host",
"mandatory": true
},
{
"tag": "RequestType",
"path": "*cgreq.RequestType",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Category",
"path": "*cgreq.Category",
"type": "*constant",
"value": "call"
},
{
"tag": "Account",
"path": "*cgreq.Account",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Destination",
"path": "*cgreq.Destination",
"type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
"mandatory": true
},
{
"tag": "AnswerTime",
"path": "*cgreq.AnswerTime",
"type": "*variable",
"value": "~*req.Event-Timestamp",
"mandatory": true
},
{
"tag": "Usage",
"path": "*cgreq.Usage",
"type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
"mandatory": true
},
{
"tag": "SubscriberID",
"path": "*cgreq.SubscriberId",
"type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data",
"mandatory": true
},
],
"reply_fields":[
{
"tag": "ResultCode",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Result-Code",
"type": "*constant",
"value": "5030",
"blocker": true
},
{
"tag": "ResultCode",
"path": "*rep.Result-Code",
"type": "*constant",
"value": "2001"
},
{
"tag": "GrantedUnits",
"path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable",
"value": "~*cgrep.MaxUsage{*duration_seconds}",
"mandatory": true
},
],
},
{
"id": "VoiceInit",
"filters": ["*string:~*vars.*cmd:CCR", "*string:~*req.CC-Request-Type:1",

View File

@@ -18,6 +18,117 @@
"type": "*constant",
"value": "*voice"
},
{
"tag": "*api_key",
"path": "*cgreq.*api_key",
"type": "*constant",
"value": "ses12345"
},
{
"tag": "OriginID",
"path": "*cgreq.OriginID",
"type": "*variable",
"value": "~*req.Session-Id",
"mandatory": true
},
{
"tag": "OriginHost",
"path": "*cgreq.OriginHost",
"type": "*remote_host",
"mandatory": true
},
{
"tag": "RequestType",
"path": "*cgreq.RequestType",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Category",
"path": "*cgreq.Category",
"type": "*constant",
"value": "call"
},
{
"tag": "Account",
"path": "*cgreq.Account",
"type": "*constant",
"value": "*attributes"
},
{
"tag": "Destination",
"path": "*cgreq.Destination",
"type": "*variable",
"value": "~*req.Service-Information.IN-Information.Real-Called-Number",
"mandatory": true
},
{
"tag": "AnswerTime",
"path": "*cgreq.AnswerTime",
"type": "*variable",
"value": "~*req.Event-Timestamp",
"mandatory": true
},
{
"tag": "Usage",
"path": "*cgreq.Usage",
"type": "*variable",
"value": "~*req.Requested-Service-Unit.CC-Time:s/(.*)/${1}s/",
"mandatory": true
},
{
"tag": "SubscriberID",
"path": "*cgreq.SubscriberId",
"type": "*variable",
"value": "~*req.Subscription-Id.Subscription-Id-Data",
"mandatory": true
},
],
"reply_fields":[
{
"tag": "ResultCode",
"filters": ["*notempty:~*cgrep.Error:"],
"path": "*rep.Result-Code",
"type": "*constant",
"value": "5030",
"blocker": true
},
{
"tag": "ResultCode",
"path": "*rep.Result-Code",
"type": "*constant",
"value": "2001"
},
{
"tag": "GrantedUnits",
"path": "*rep.Granted-Service-Unit.CC-Time",
"type": "*variable",
"value": "~*cgrep.MaxUsage{*duration_seconds}",
"mandatory": true
},
],
},
{
"id": "VoiceInitForceDuration",
"filters": [
"*string:~*vars.*cmd:CCR",
"*string:~*req.CC-Request-Type:1",
"*prefix:~*req.Service-Context-Id:forceDurationVoice"
],
"flags": ["*initiate", "*fd", "*accounts", "*attributes"],
"request_fields":[
{
"tag": "ToR",
"path": "*cgreq.ToR",
"type": "*constant",
"value": "*voice"
},
{
"tag": "*api_key",
"path": "*cgreq.*api_key",
"type": "*constant",
"value": "ses12345"
},
{
"tag": "OriginID",
"path": "*cgreq.OriginID",