mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Renamed *multiple flag to *chargers
This commit is contained in:
committed by
Dan Christian Bogos
parent
a381e3a670
commit
12e2c1082a
@@ -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.MetaMultiple},
|
||||
utils.MetaRoutes, utils.MetaAttributes, utils.MetaChargers},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessEventAuth",
|
||||
@@ -238,7 +238,7 @@ func testSSv1ItProcessEventInitiateSession(t *testing.T) {
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInitiate),
|
||||
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAllocate), utils.MetaAttributes,
|
||||
utils.MetaMultiple},
|
||||
utils.MetaChargers},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
ID: "testSSv1ItProcessEventInitiateSession",
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event","*multiple", "*routes", "*attributes","*continue"],
|
||||
"flags": ["*event","*chargers", "*routes", "*attributes","*continue"],
|
||||
"request_fields":[
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
|
||||
"value": "~*req.From{*sipuri_user}", "mandatory": true},
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event","*multiple", "*routes", "*attributes","*continue"],
|
||||
"flags": ["*event","*chargers", "*routes", "*attributes","*continue"],
|
||||
"request_fields":[
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
|
||||
"value": "~*req.From{*sipuri_user}", "mandatory": true},
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
{
|
||||
"id": "RoutesQuery",
|
||||
"filters": ["*string:~*vars.Method:INVITE"],
|
||||
"flags": ["*event","*multiple", "*routes", "*attributes","*continue"],
|
||||
"flags": ["*event","*chargers", "*routes", "*attributes","*continue"],
|
||||
"request_fields":[
|
||||
{"tag": "Account", "path": "*cgreq.Account", "type": "*variable",
|
||||
"value": "~*req.From{*sipuri_user}", "mandatory": true},
|
||||
|
||||
@@ -79,7 +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
|
||||
* [SessionS] Added *chargers flag to ProcessEvent to proccess the events from ChargerS with other subsystems
|
||||
|
||||
-- DanB <danb@cgrates.org> Wed, 19 Feb 2020 13:25:52 +0200
|
||||
|
||||
|
||||
@@ -3160,7 +3160,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
ArgDispatcher: args.ArgDispatcher,
|
||||
},
|
||||
}
|
||||
if argsFlagsWithParams.GetBool(utils.MetaMultiple) {
|
||||
if argsFlagsWithParams.GetBool(utils.MetaChargers) {
|
||||
var chrgrs []*engine.ChrgSProcessEventReply
|
||||
if chrgrs, err = sS.processChargerS(&utils.CGREventWithOpts{
|
||||
CGREvent: args.CGREvent,
|
||||
@@ -3180,10 +3180,11 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
|
||||
// check for *attribute
|
||||
if argsFlagsWithParams.HasKey(utils.MetaAttributes) {
|
||||
attrIDs := argsFlagsWithParams.ParamsSlice(utils.MetaAttributes)
|
||||
rply.Attributes = make(map[string]*engine.AttrSProcessEventReply)
|
||||
for runID, cgrEv := range events {
|
||||
rplyAttr, err := sS.processAttributes(cgrEv.CGREvent, cgrEv.ArgDispatcher,
|
||||
argsFlagsWithParams.ParamsSlice(utils.MetaAttributes), cgrEv.Opts)
|
||||
attrIDs, cgrEv.Opts)
|
||||
if err != nil {
|
||||
if err.Error() != utils.ErrNotFound.Error() {
|
||||
return utils.NewErrAttributeS(err)
|
||||
@@ -3231,9 +3232,9 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
// process thresholds if required
|
||||
if argsFlagsWithParams.HasKey(utils.MetaThresholds) {
|
||||
rply.ThresholdIDs = make(map[string][]string)
|
||||
thIDs := argsFlagsWithParams.ParamsSlice(utils.MetaThresholds)
|
||||
for runID, cgrEv := range events {
|
||||
tIDs, err := sS.processThreshold(cgrEv.CGREvent, cgrEv.ArgDispatcher,
|
||||
argsFlagsWithParams.ParamsSlice(utils.MetaThresholds))
|
||||
tIDs, err := sS.processThreshold(cgrEv.CGREvent, cgrEv.ArgDispatcher, thIDs)
|
||||
if err != nil && err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
fmt.Sprintf("<%s> error: %s processing event %+v for RunID <%s> with ThresholdS.",
|
||||
@@ -3247,9 +3248,9 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
// process stats if required
|
||||
if argsFlagsWithParams.HasKey(utils.MetaStats) {
|
||||
rply.StatQueueIDs = make(map[string][]string)
|
||||
stIDs := argsFlagsWithParams.ParamsSlice(utils.MetaStats)
|
||||
for runID, cgrEv := range events {
|
||||
sIDs, err := sS.processStats(cgrEv.CGREvent, cgrEv.ArgDispatcher,
|
||||
argsFlagsWithParams.ParamsSlice(utils.MetaStats))
|
||||
sIDs, err := sS.processStats(cgrEv.CGREvent, cgrEv.ArgDispatcher, stIDs)
|
||||
if err != nil &&
|
||||
err.Error() != utils.ErrNotFound.Error() {
|
||||
utils.Logger.Warning(
|
||||
@@ -3323,21 +3324,21 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
return utils.NewErrNotConnected(utils.ResourceS)
|
||||
}
|
||||
rply.ResourceAllocation = make(map[string]string)
|
||||
for runID, cgrEv := range events {
|
||||
originID := engine.MapEvent(cgrEv.CGREvent.Event).GetStringIgnoreErrors(utils.OriginID)
|
||||
if originID == "" {
|
||||
return utils.NewErrMandatoryIeMissing(utils.OriginID)
|
||||
}
|
||||
if resOpt := argsFlagsWithParams.ParamsSlice(utils.MetaResources); len(resOpt) != 0 {
|
||||
for runID, cgrEv := range events {
|
||||
originID := engine.MapEvent(cgrEv.CGREvent.Event).GetStringIgnoreErrors(utils.OriginID)
|
||||
if originID == "" {
|
||||
return utils.NewErrMandatoryIeMissing(utils.OriginID)
|
||||
}
|
||||
|
||||
attrRU := &utils.ArgRSv1ResourceUsage{
|
||||
CGREvent: cgrEv.CGREvent,
|
||||
UsageID: originID,
|
||||
Units: 1,
|
||||
ArgDispatcher: cgrEv.ArgDispatcher,
|
||||
}
|
||||
var resMessage string
|
||||
// check what we need to do for resources (*authorization/*allocation)
|
||||
if resOpt := argsFlagsWithParams.ParamsSlice(utils.MetaResources); len(resOpt) != 0 {
|
||||
attrRU := &utils.ArgRSv1ResourceUsage{
|
||||
CGREvent: cgrEv.CGREvent,
|
||||
UsageID: originID,
|
||||
Units: 1,
|
||||
ArgDispatcher: cgrEv.ArgDispatcher,
|
||||
}
|
||||
var resMessage string
|
||||
// check what we need to do for resources (*authorization/*allocation)
|
||||
//check for subflags and convert them into utils.FlagsWithParams
|
||||
resourceFlagsWithParams, err := utils.FlagsWithParamsFromSlice(resOpt)
|
||||
if err != nil {
|
||||
|
||||
@@ -2268,8 +2268,8 @@ const (
|
||||
OptsAPIKey = "*dispatcherApiKey"
|
||||
OptsRouteID = "*dispatcherRouteID"
|
||||
// Others
|
||||
OptsContext = "*context"
|
||||
MetaMultiple = "*multiple"
|
||||
OptsContext = "*context"
|
||||
MetaDerivedReply = "*derivedreply"
|
||||
)
|
||||
|
||||
func buildCacheInstRevPrefixes() {
|
||||
|
||||
Reference in New Issue
Block a user