Updated SessionS.V1ProcessEvent integration tests

This commit is contained in:
Trial97
2020-07-15 13:06:48 +03:00
committed by Dan Christian Bogos
parent b8e6678ca1
commit aaba103bd8
25 changed files with 122 additions and 108 deletions

View File

@@ -29,6 +29,7 @@ import (
"os/exec"
"path"
"reflect"
"sort"
"testing"
"time"
@@ -151,8 +152,12 @@ func testPreloadITVerifyAttributes(t *testing.T) {
t.Fatal(err)
}
reply.Compile()
sort.Strings(reply.Contexts)
if !reflect.DeepEqual(eAttrPrf, reply) {
t.Errorf("Expecting : %+v,\n received: %+v", utils.ToJSON(eAttrPrf), utils.ToJSON(reply))
eAttrPrf.Attributes[1].FilterIDs = nil
if !reflect.DeepEqual(eAttrPrf, reply) {
t.Errorf("Expecting : %+v,\n received: %+v", utils.ToJSON(eAttrPrf), utils.ToJSON(reply))
}
}
}

View File

@@ -158,7 +158,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.ConcatenatedKey(utils.MetaResources, utils.MetaAuthorize),
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaAuthorize),
utils.MetaRoutes, utils.MetaAttributes},
utils.MetaRoutes, utils.MetaAttributes, utils.MetaMultiple},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventAuth",
@@ -204,8 +204,8 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
},
},
}
if !reflect.DeepEqual(eSplrs, rply.Routes) {
t.Errorf("expecting: %+v,\n received: %+v", utils.ToJSON(eSplrs), utils.ToJSON(rply.Routes))
if !reflect.DeepEqual(eSplrs, rply.Routes[utils.MetaRaw]) {
t.Errorf("expecting: %+v,\n received: %+v", utils.ToJSON(eSplrs), utils.ToJSON(rply.Routes[utils.MetaRaw]))
}
eAttrs := &engine.AttrSProcessEventReply{
MatchedProfiles: []string{"ATTR_ACNT_1001"},
@@ -227,9 +227,9 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
},
},
}
if !reflect.DeepEqual(eAttrs, rply.Attributes) {
if !reflect.DeepEqual(eAttrs, rply.Attributes[utils.MetaRaw]) {
t.Errorf("expecting: %+v, received: %+v",
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes))
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes[utils.MetaRaw]))
}
}
@@ -237,7 +237,8 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
initUsage := 5 * time.Minute
args := &sessions.V1ProcessEventArgs{
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInitiate),
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAllocate), utils.MetaAttributes},
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAllocate), utils.MetaAttributes,
utils.MetaMultiple},
CGREvent: &utils.CGREvent{
Tenant: "cgrates.org",
ID: "testSSv1ItProcessEventInitiateSession",
@@ -290,9 +291,9 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
},
},
}
if !reflect.DeepEqual(eAttrs, rply.Attributes) {
if !reflect.DeepEqual(eAttrs, rply.Attributes[utils.MetaRaw]) {
t.Errorf("expecting: %+v, received: %+v",
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes))
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes[utils.MetaRaw]))
}
aSessions := make([]*sessions.ExternalSession, 0)
if err := sSv1BiRpc.Call(utils.SessionSv1GetActiveSessions, &utils.SessionFilter{}, &aSessions); err != nil {
@@ -349,9 +350,9 @@ func testSSv1ItProcessEventUpdateSession(t *testing.T) {
},
},
}
if !reflect.DeepEqual(eAttrs, rply.Attributes) {
if !reflect.DeepEqual(eAttrs, rply.Attributes[utils.MetaRaw]) {
t.Errorf("expecting: %+v, received: %+v",
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes))
utils.ToJSON(eAttrs), utils.ToJSON(rply.Attributes[utils.MetaRaw]))
}
// in case of prepaid and pseudoprepade we expect a MaxUsage of 5min
// and in case of postpaid and rated we expect the value of Usage field
@@ -499,15 +500,15 @@ func testSSv1ItProcessEventWithGetCost(t *testing.T) {
}
if rply.Attributes == nil {
t.Error("Received nil Attributes")
} else if !reflect.DeepEqual(rply.Attributes.MatchedProfiles, []string{"ATTR_SUBJECT_CASE1"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE1"}, rply.Attributes.MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes.AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes.AlteredFields)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].MatchedProfiles, []string{"ATTR_SUBJECT_CASE1"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE1"}, rply.Attributes[utils.MetaRaw].MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes[utils.MetaRaw].AlteredFields)
}
if rply.Cost == nil {
t.Errorf("Received nil Cost")
} else if *rply.Cost != 0.198 { // same cost as in CDR
t.Errorf("Expected: %+v,received: %+v", 0.198, *rply.Cost)
} else if rply.Cost[utils.MetaRaw] != 0.198 { // same cost as in CDR
t.Errorf("Expected: %+v,received: %+v", 0.198, rply.Cost[utils.MetaRaw])
}
}
@@ -538,15 +539,15 @@ func testSSv1ItProcessEventWithGetCost2(t *testing.T) {
}
if rply.Attributes == nil {
t.Error("Received nil Attributes")
} else if !reflect.DeepEqual(rply.Attributes.MatchedProfiles, []string{"ATTR_SUBJECT_CASE2"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE2"}, rply.Attributes.MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes.AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes.AlteredFields)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].MatchedProfiles, []string{"ATTR_SUBJECT_CASE2"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE2"}, rply.Attributes[utils.MetaRaw].MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes[utils.MetaRaw].AlteredFields)
}
if rply.Cost == nil {
t.Errorf("Received nil Cost")
} else if *rply.Cost != 0.102 { // same cost as in CDR
t.Errorf("Expected: %+v,received: %+v", 0.102, *rply.Cost)
} else if rply.Cost[utils.MetaRaw] != 0.102 { // same cost as in CDR
t.Errorf("Expected: %+v,received: %+v", 0.102, rply.Cost[utils.MetaRaw])
}
}
@@ -579,15 +580,15 @@ func testSSv1ItProcessEventWithGetCost3(t *testing.T) {
}
if rply.Attributes == nil {
t.Error("Received nil Attributes")
} else if !reflect.DeepEqual(rply.Attributes.MatchedProfiles, []string{"ATTR_SUBJECT_CASE3"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE3"}, rply.Attributes.MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes.AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes.AlteredFields)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].MatchedProfiles, []string{"ATTR_SUBJECT_CASE3"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"ATTR_SUBJECT_CASE3"}, rply.Attributes[utils.MetaRaw].MatchedProfiles)
} else if !reflect.DeepEqual(rply.Attributes[utils.MetaRaw].AlteredFields, []string{"*req.Subject"}) {
t.Errorf("Expected: %+v,received: %+v", []string{"*req.Subject"}, rply.Attributes[utils.MetaRaw].AlteredFields)
}
if rply.Cost == nil {
t.Errorf("Received nil Cost")
} else if *rply.Cost != 2.9999 {
t.Errorf("Expected: %+v,received: %+v", 2.9999, *rply.Cost)
} else if rply.Cost[utils.MetaRaw] != 2.9999 {
t.Errorf("Expected: %+v,received: %+v", 2.9999, rply.Cost[utils.MetaRaw])
}
}

View File

@@ -481,12 +481,19 @@ func main() {
})
dmService := services.NewDataDBService(cfg, connManager)
storDBService := services.NewStorDBService(cfg)
if dmService.ShouldRun() { // Some services can run without db, ie: ERs
if err = dmService.Start(); err != nil {
return
}
}
storDBService := services.NewStorDBService(cfg)
if storDBService.ShouldRun() { // Some services can run without db, ie: ERs
if err = storDBService.Start(); err != nil {
return
}
}
// Done initing DBs
engine.SetRoundingDecimals(cfg.GeneralCfg().RoundingDecimals)
engine.SetFailedPostCacheTTL(cfg.GeneralCfg().FailedPostsTTL)

View File

@@ -73,7 +73,7 @@
{"tag": "CCATemplate", "type": "*template", "value": "*cca"},
{
"tag": "ResultCode","path": "*rep.Result-Code",
"filters": ["*eq:~*cgrep.MaxUsage:0"],
"filters": ["*eq:~*cgrep.MaxUsage[*raw]:0"],
"type": "*constant", "value": "4012",
"blocker": true
},

View File

@@ -81,7 +81,7 @@
},
{
"tag": "DebitInterval",
"path": "*opts.DebitInterval",
"path": "*opts.*sessionDebitInterval",
"type": "*constant",
"value": "1s"
},

View File

@@ -84,7 +84,7 @@
},
{
"tag": "ResultCode","path": "*rep.Result-Code",
"filters": ["*eq:~*cgrep.MaxUsage:0"],
"filters": ["*eq:~*cgrep.MaxUsage[*raw]:0"],
"type": "*constant", "value": "4012",
"blocker": true
},

View File

@@ -81,7 +81,7 @@
},
{
"tag": "DebitInterval",
"path": "*opts.DebitInterval",
"path": "*opts.*sessionDebitInterval",
"type": "*constant",
"value": "1s"
},

View File

@@ -81,7 +81,7 @@
},
{
"tag": "DebitInterval",
"path": "*opts.DebitInterval",
"path": "*opts.*sessionDebitInterval",
"type": "*constant",
"value": "1s"
},

View File

@@ -84,7 +84,7 @@
},
{
"tag": "ResultCode","path": "*rep.Result-Code",
"filters": ["*eq:~*cgrep.MaxUsage:0"],
"filters": ["*eq:~*cgrep.MaxUsage[*raw]:0"],
"type": "*constant", "value": "4012",
"blocker": true
},

View File

@@ -10,7 +10,7 @@
"flags": ["*initiate", "*accounts"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "APIkey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIkey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"},
@@ -38,7 +38,7 @@
"flags": ["*update", "*accounts","*continue"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "APIkey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIkey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "InitialOriginID", "path": "*cgreq.InitialOriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed",
@@ -71,7 +71,7 @@
"flags": ["*update", "*accounts"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "APIkey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIkey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "InitialOriginID", "path": "*cgreq.InitialOriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*composed",
@@ -104,7 +104,7 @@
"flags": ["*terminate", "*accounts"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*data"},
{"tag": "APIkey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIkey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginIDPrefix", "path": "*cgreq.OriginIDPrefix", "type": "*variable",

View File

@@ -8,7 +8,7 @@
"flags": ["*dryrun","*continue"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "Val1", "path": "*cgreq.Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "path": "*cgreq.Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "path": "*cgreq.Val3", "type": "*constant", "value": "3"},
@@ -43,7 +43,7 @@
"flags": ["*dryrun"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "Val1", "path": "*cgreq.Val1", "type": "*constant", "value": "1"},
{"tag": "Val2", "path": "*cgreq.Val2", "type": "*constant", "value": "2"},
{"tag": "Val3", "path": "*cgreq.Val3", "type": "*constant", "value": "3"},

View File

@@ -10,7 +10,7 @@
"flags": ["*message", "*accounts", "*cdrs","*attributes"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*sms"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "Category", "path": "*cgreq.Category", "type": "*constant", "value": "sms"},

View File

@@ -19,7 +19,7 @@
"value": "*mms"
},
{ "tag": "APIKey",
"path": "*opts.APIKey",
"path": "*opts.*dispatcherApiKey",
"type": "*constant",
"value": "ses12345"
},

View File

@@ -10,7 +10,7 @@
"flags": ["*message", "*accounts", "*log"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*generic"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "RequestType", "path": "*cgreq.RequestType", "type": "*constant", "value": "*prepaid"},

View File

@@ -10,7 +10,7 @@
"flags": ["*initiate", "*accounts","*attributes"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "type": "*constant", "value": "ses12345"},
{"tag": "OriginID", "path": "*cgreq.OriginID", "type": "*variable",
"value": "~*req.Session-Id", "mandatory": true},
{"tag": "OriginHost", "path": "*cgreq.OriginHost", "type": "*variable",
@@ -29,7 +29,7 @@
"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": "DebitInterval", "path": "*opts.DebitInterval",
{"tag": "DebitInterval", "path": "*opts.*sessionDebitInterval",
"type": "*constant", "value": "1s"},
],
"reply_fields":[

View File

@@ -109,7 +109,7 @@
"flags": ["*initiate", "*accounts", "*attributes"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "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",
@@ -141,7 +141,7 @@
"flags": ["*update", "*accounts", "*attributes"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "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",
@@ -175,7 +175,7 @@
"flags": ["*terminate", "*accounts", "*attributes", "*cdrs"],
"request_fields":[
{"tag": "ToR", "path": "*cgreq.ToR", "type": "*constant", "value": "*voice"},
{"tag": "APIKey", "path": "*opts.APIKey", "type": "*constant", "value": "ses12345"},
{"tag": "APIKey", "path": "*opts.*dispatcherApiKey", "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",

View File

@@ -32,7 +32,7 @@
{
"id": "RoutesQueryOneRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:1",
"*gte:~*cgrep.Routes[*raw].Count:1",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
@@ -49,21 +49,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[0].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryTwoRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:2",
"*gte:~*cgrep.Routes[*raw].Count:2",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -78,21 +78,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[1].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.2;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryThreeRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:3",
"*gte:~*cgrep.Routes[*raw].Count:3",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -107,15 +107,15 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[2].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.1;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.MaxUsage"}
]
}
]

View File

@@ -32,7 +32,7 @@
{
"id": "RoutesQueryOneRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:1",
"*gte:~*cgrep.Routes[*raw].Count:1",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
@@ -49,21 +49,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[0].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryTwoRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:2",
"*gte:~*cgrep.Routes[*raw].Count:2",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -78,21 +78,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[1].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.2;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryThreeRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:3",
"*gte:~*cgrep.Routes[*raw].Count:3",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -107,15 +107,15 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[2].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.1;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.MaxUsage"}
]
}
]

View File

@@ -32,7 +32,7 @@
{
"id": "RoutesQueryOneRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:1",
"*gte:~*cgrep.Routes[*raw].Count:1",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
@@ -49,21 +49,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[0].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryTwoRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:2",
"*gte:~*cgrep.Routes[*raw].Count:2",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -78,21 +78,21 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[1].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.2;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.MaxUsage"}
]
},
{
"id": "RoutesQueryThreeRoutes",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:3",
"*gte:~*cgrep.Routes[*raw].Count:3",
],
"flags": ["*none","*continue"],
"reply_fields":[
@@ -107,15 +107,15 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"@"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[2].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>;q=0.1;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"}
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.MaxUsage"}
]
}
]

View File

@@ -28,9 +28,9 @@
"value": "*now", "mandatory": true},
{"tag": "Category", "path": "*cgreq.Category", "type": "*variable",
"value": "call", "mandatory": true},
{"tag": "STIRPublicKeyPath", "path": "*opts.STIRPublicKeyPath", "type": "*constant",
{"tag": "STIRPublicKeyPath", "path": "*opts.*stirPublicKeyPath", "type": "*constant",
"value": "/usr/share/cgrates/stir/stir_pubkey.pem", "mandatory": true},
{"tag": "STIRPrivateKeyPath", "path": "*opts.STIRPrivateKeyPath", "type": "*constant",
{"tag": "STIRPrivateKeyPath", "path": "*opts.*stirPrivateKeyPath", "type": "*constant",
"value": "/usr/share/cgrates/stir/stir_privatekey.pem", "mandatory": true},
],
"reply_fields":[
@@ -39,7 +39,7 @@
{
"id": "RoutesQueryOneRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:1",
"*gte:~*cgrep.Routes[*raw].Count:1",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
@@ -48,57 +48,57 @@
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"\"1003\" <sip:"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[0].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[0].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].SortingData.MaxUsage"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].SortingData.MaxUsage"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_route=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[0].RouteID"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[0].RouteID"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>`"},
{"tag": "X-Identity", "path": "*rep.X-Identity", "type": "*variable",
"value":"~*cgrep.STIRIdentity.<~*cgrep.Routes.SortedRoutes[0].RouteID>"},
"value":"~*cgrep.STIRIdentity.<~*cgrep.Routes[*raw].SortedRoutes[0].RouteID>"},
]
},
{
"id": "RoutesQueryTwoRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:2",
"*gte:~*cgrep.Routes[*raw].Count:2",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":",\"1004\" <sip:"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[1].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[1].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].SortingData.MaxUsage"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].SortingData.MaxUsage"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_route=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[1].RouteID"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[1].RouteID"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>`"},
@@ -107,29 +107,29 @@
{
"id": "RoutesQueryThreeRoute",
"filters": ["*string:~*vars.Method:INVITE",
"*gte:~*cgrep.Routes.Count:2",
"*gte:~*cgrep.Routes[*raw].Count:2",
],
"flags": ["*none","*continue"], // do not send request to CGRateS
"reply_fields":[
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":",\"1005\" <sip:"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value": "~*cgrep.Routes.SortedRoutes[2].RouteParameters"},
"value": "~*cgrep.Routes[*raw].SortedRoutes[2].RouteParameters"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;q=0.7; expires=3600;cgr_cost=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.Cost"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.Cost"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_maxusage=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].SortingData.MaxUsage"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].SortingData.MaxUsage"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`;cgr_route=`"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"~*cgrep.Routes.SortedRoutes[2].RouteID"},
"value":"~*cgrep.Routes[*raw].SortedRoutes[2].RouteID"},
{"tag": "Contact", "path": "*rep.Contact", "type": "*composed",
"value":"`>`"},

View File

@@ -250,7 +250,7 @@ func testSes2StirInit(t *testing.T) {
args, &rply); err != nil { // no error verificated with success
t.Error(err)
}
if err := sessions.AuthStirShaken(rply.STIRIdentity["DEFAULT"], "1001", "", "1002", "", utils.NewStringSet([]string{"A"}), 10*time.Minute); err != nil {
if err := sessions.AuthStirShaken(rply.STIRIdentity[utils.MetaRaw], "1001", "", "1002", "", utils.NewStringSet([]string{"A"}), 10*time.Minute); err != nil {
t.Fatal(err)
}
}

View File

@@ -79,6 +79,7 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
* [RSRParsers] Moved RSRFilter from RSRParsers to the *rsr FilterS
* [SessionS] Rename from ResourceMessage to ResourceAllocation
* [LoaderS] Updated file selector from *req<FileName> to *file(FileName)
* [SessionS] Added *multiple flag to ProcessEvent to proccess the events from ChargerS with other subsystems
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200

View File

@@ -154,7 +154,7 @@ func (srvMngr *ServiceManager) StartServices() (err error) {
if err == utils.ErrServiceAlreadyRunning { // in case the service was started in another gorutine
return
}
utils.Logger.Err(fmt.Sprintf("<%s> failed to start %s because: %s", utils.ServiceManager, service.ServiceName(), err))
utils.Logger.Err(fmt.Sprintf("<%s> failed to start %s because: %s", utils.ServiceManager, srv.ServiceName(), err))
srvMngr.engineShutdown <- true
}
}(service)

View File

@@ -3160,7 +3160,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
ArgDispatcher: args.ArgDispatcher,
},
}
if argsFlagsWithParams.GetBool(utils.OptsMultiple) {
if argsFlagsWithParams.GetBool(utils.MetaMultiple) {
var chrgrs []*engine.ChrgSProcessEventReply
if chrgrs, err = sS.processChargerS(&utils.CGREventWithOpts{
CGREvent: args.CGREvent,

View File

@@ -2267,7 +2267,7 @@ const (
OptsRouteID = "*dispatcherRouteID"
// Others
OptsContext = "*context"
OptsMultiple = "*multiple"
MetaMultiple = "*multiple"
)
func buildCacheInstRevPrefixes() {