mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-12 18:46:24 +05:00
Changed opts for Sessions and CDRs
This commit is contained in:
committed by
Dan Christian Bogos
parent
9f24c47d61
commit
323fa2389c
@@ -574,8 +574,8 @@ func TestCDRLogActionExecute(t *testing.T) {
|
||||
if !can {
|
||||
return fmt.Errorf("Wrong argument type: %T", arg)
|
||||
}
|
||||
if argConv.APIOpts[utils.OptsCDRsChargerS].(bool) {
|
||||
return fmt.Errorf("Expected false, received %+v", argConv.APIOpts[utils.OptsCDRsChargerS])
|
||||
if argConv.APIOpts[utils.OptsChargerS].(bool) {
|
||||
return fmt.Errorf("Expected false, received %+v", argConv.APIOpts[utils.OptsChargerS])
|
||||
}
|
||||
if val, has := argConv.Event[utils.Subject]; !has {
|
||||
return fmt.Errorf("missing Subject")
|
||||
@@ -645,8 +645,8 @@ func TestCDRLogActionWithOpts(t *testing.T) {
|
||||
if !can {
|
||||
return fmt.Errorf("Wrong argument type: %T", arg)
|
||||
}
|
||||
if argConv.APIOpts[utils.OptsCDRsChargerS].(bool) {
|
||||
return fmt.Errorf("Expected false, received %+v", argConv.APIOpts[utils.OptsCDRsChargerS])
|
||||
if argConv.APIOpts[utils.OptsChargerS].(bool) {
|
||||
return fmt.Errorf("Expected false, received %+v", argConv.APIOpts[utils.OptsChargerS])
|
||||
}
|
||||
if val, has := argConv.Event[utils.Tenant]; !has {
|
||||
return fmt.Errorf("missing Tenant")
|
||||
|
||||
@@ -77,7 +77,7 @@ func (aL *actCDRLog) execute(ctx *context.Context, data utils.MapStorage, _ stri
|
||||
if optsMS == nil {
|
||||
optsMS = utils.MapStorage{}
|
||||
}
|
||||
optsMS[utils.OptsCDRsChargerS] = false // do not try to get the chargers for cdrlog
|
||||
optsMS[utils.OptsChargerS] = false // do not try to get the chargers for cdrlog
|
||||
oNm := map[string]*utils.OrderedNavigableMap{
|
||||
utils.MetaCDR: utils.NewOrderedNavigableMap(),
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ func TestProcessRequest(t *testing.T) {
|
||||
"Usage": "10s",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsSesAttributeS: "true",
|
||||
utils.OptsSesInitiate: "true",
|
||||
utils.OptsAttributeS: "true",
|
||||
utils.OptsSesInitiate: "true",
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expargs, arg) {
|
||||
@@ -246,8 +246,8 @@ func TestProcessRequest(t *testing.T) {
|
||||
"Usage": "10s",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsSesAttributeS: "true",
|
||||
utils.OptsSesUpdate: "true",
|
||||
utils.OptsAttributeS: "true",
|
||||
utils.OptsSesUpdate: "true",
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expargs, arg) {
|
||||
@@ -379,8 +379,8 @@ func TestProcessRequest(t *testing.T) {
|
||||
"Usage": "10s",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsSesAttributeS: "true",
|
||||
utils.OptsSesMessage: "true",
|
||||
utils.OptsAttributeS: "true",
|
||||
utils.OptsSesMessage: "true",
|
||||
},
|
||||
}
|
||||
if !reflect.DeepEqual(expargs, arg) {
|
||||
@@ -450,7 +450,7 @@ func TestProcessRequest(t *testing.T) {
|
||||
tmpls := []*config.FCTemplate{
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesInitiate,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesAttributeS,
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsAttributeS,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
}
|
||||
for _, v := range tmpls {
|
||||
@@ -479,7 +479,7 @@ func TestProcessRequest(t *testing.T) {
|
||||
tmpls = []*config.FCTemplate{
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesUpdate,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesAttributeS,
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsAttributeS,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
}
|
||||
for _, v := range tmpls {
|
||||
@@ -539,7 +539,7 @@ func TestProcessRequest(t *testing.T) {
|
||||
tmpls = []*config.FCTemplate{
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesMessage,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsSesAttributeS,
|
||||
{Type: utils.MetaConstant, Path: utils.MetaOpts + utils.NestingSep + utils.OptsAttributeS,
|
||||
Value: config.NewRSRParsersMustCompile("true", utils.InfieldSep)},
|
||||
}
|
||||
for _, v := range tmpls {
|
||||
|
||||
@@ -242,7 +242,7 @@ func (kev KamEvent) AsKamProcessMessageReply(procEvArgs *utils.CGREvent,
|
||||
kar.Error = rplyErr.Error()
|
||||
return
|
||||
}
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesAttributeS) && procEvReply.Attributes != nil {
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsAttributeS) && procEvReply.Attributes != nil {
|
||||
kar.Attributes = procEvReply.Attributes.Digest()
|
||||
}
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesResourceSAlocate) {
|
||||
@@ -251,14 +251,14 @@ func (kev KamEvent) AsKamProcessMessageReply(procEvArgs *utils.CGREvent,
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesMessage) {
|
||||
kar.MaxUsage = procEvReply.MaxUsage.Seconds()
|
||||
}
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesRouteS) && procEvReply.RouteProfiles != nil {
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsRouteS) && procEvReply.RouteProfiles != nil {
|
||||
kar.Routes = procEvReply.RouteProfiles.Digest()
|
||||
}
|
||||
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesThresholdS) {
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsThresholdS) {
|
||||
kar.Thresholds = strings.Join(*procEvReply.ThresholdIDs, utils.FieldsSep)
|
||||
}
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsSesStatS) {
|
||||
if utils.OptAsBool(procEvArgs.APIOpts, utils.OptsStatS) {
|
||||
kar.StatQueues = strings.Join(*procEvReply.StatQueueIDs, utils.FieldsSep)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -318,8 +318,8 @@ func TestKamEvAsKamProcessEventReply(t *testing.T) {
|
||||
}
|
||||
kamEv = KamEvent{"event": "CGR_PROFILE_REQUEST",
|
||||
"Tenant": "cgrates.org", "Account": "1001",
|
||||
KamReplyRoute: "CGR_PROFILE_REPLY",
|
||||
utils.OptsSesAttributeS: "true",
|
||||
KamReplyRoute: "CGR_PROFILE_REPLY",
|
||||
utils.OptsAttributeS: "true",
|
||||
}
|
||||
procEvArgs = &utils.CGREvent{
|
||||
Tenant: utils.FirstNonEmpty(kamEv[utils.Tenant],
|
||||
|
||||
@@ -313,12 +313,12 @@ func (cdrS *CDRServer) V1ProcessEvent(ctx *context.Context, arg *utils.CGREvent,
|
||||
// end of RPC caching
|
||||
|
||||
// processing options
|
||||
attrS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsAttributeS, len(cdrS.cfg.CdrsCfg().AttributeSConns) != 0)
|
||||
attrS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsAttributeS, len(cdrS.cfg.CdrsCfg().AttributeSConns) != 0)
|
||||
export := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsExport, len(cdrS.cfg.CdrsCfg().OnlineCDRExports) != 0 ||
|
||||
len(cdrS.cfg.CdrsCfg().EEsConns) != 0)
|
||||
thdS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsThresholdS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
stS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsStatS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
chrgS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsChargerS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
thdS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsThresholdS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
stS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsStatS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
chrgS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsChargerS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
rateS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsRateS, len(cdrS.cfg.CdrsCfg().RateSConns) != 0)
|
||||
acntS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsAccountS, len(cdrS.cfg.CdrsCfg().AccountSConns) != 0)
|
||||
|
||||
@@ -358,12 +358,12 @@ func (cdrS *CDRServer) V1ProcessEventWithGet(ctx *context.Context, arg *utils.CG
|
||||
// end of RPC caching
|
||||
|
||||
// processing options
|
||||
attrS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsAttributeS, len(cdrS.cfg.CdrsCfg().AttributeSConns) != 0)
|
||||
attrS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsAttributeS, len(cdrS.cfg.CdrsCfg().AttributeSConns) != 0)
|
||||
export := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsExport, len(cdrS.cfg.CdrsCfg().OnlineCDRExports) != 0 ||
|
||||
len(cdrS.cfg.CdrsCfg().EEsConns) != 0)
|
||||
thdS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsThresholdS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
stS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsStatS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
chrgS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsCDRsChargerS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
thdS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsThresholdS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
stS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsStatS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
chrgS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsChargerS, len(cdrS.cfg.CdrsCfg().ThresholdSConns) != 0)
|
||||
rateS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsRateS, len(cdrS.cfg.CdrsCfg().RateSConns) != 0)
|
||||
acntS := utils.OptAsBoolOrDef(arg.APIOpts, utils.OptsAccountS, len(cdrS.cfg.CdrsCfg().AccountSConns) != 0)
|
||||
// end of processing options
|
||||
|
||||
@@ -236,7 +236,7 @@ func testCDRsOnExpDisableOnlineExport(t *testing.T) {
|
||||
}
|
||||
testEv := testCdr.AsCGREvent()
|
||||
testEv.APIOpts[utils.OptsCDRsExport] = false
|
||||
testEv.APIOpts[utils.OptsCDRsChargerS] = false
|
||||
testEv.APIOpts[utils.OptsChargerS] = false
|
||||
var reply string
|
||||
if err := cdrsMasterRpc.Call(context.Background(), utils.CDRsV1ProcessEvent,
|
||||
testEv, &reply); err != nil {
|
||||
|
||||
@@ -157,13 +157,13 @@ func testCDRsPostFailoverProcessCDR(t *testing.T) {
|
||||
"fieldextr2": "valextr2",
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsCDRsExport: true,
|
||||
utils.OptsCDRsAttributeS: false,
|
||||
utils.OptsCDRsExport: true,
|
||||
utils.OptsAttributeS: false,
|
||||
// utils.MetaRalS:false,
|
||||
utils.OptsCDRsChargerS: false,
|
||||
utils.OptsCDRsStore: false,
|
||||
utils.OptsCDRsThresholdS: false,
|
||||
utils.OptsCDRsStatS: false,
|
||||
utils.OptsChargerS: false,
|
||||
utils.OptsCDRsStore: false,
|
||||
utils.OptsThresholdS: false,
|
||||
utils.OptsStatS: false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ func testSes4CDRsProcessCDR(t *testing.T) {
|
||||
APIOpts: map[string]interface{}{
|
||||
// utils.MetaRALs:true,
|
||||
utils.OptsCDRsStore: true,
|
||||
utils.OptsSesRouteS: false,
|
||||
utils.OptsRouteS: false,
|
||||
utils.OptsCDRsRerate: true,
|
||||
},
|
||||
// Flags: []string{utils.MetaRALs, utils.MetaStore, "*routes:false", utils.MetaRerate},
|
||||
|
||||
@@ -117,8 +117,8 @@ func TestSessionSReload1(t *testing.T) {
|
||||
utils.Usage: 0,
|
||||
},
|
||||
APIOpts: map[string]interface{}{
|
||||
utils.OptsSesInitiate: true,
|
||||
utils.OptsSesThresholdS: true,
|
||||
utils.OptsSesInitiate: true,
|
||||
utils.OptsThresholdS: true,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -366,8 +366,8 @@ func (sS *SessionS) forceSTerminate(ctx *context.Context, s *Session, extraUsage
|
||||
if cgrEv.APIOpts == nil {
|
||||
cgrEv.APIOpts = make(map[string]interface{})
|
||||
}
|
||||
cgrEv.APIOpts[utils.OptsCDRsAttributeS] = false
|
||||
cgrEv.APIOpts[utils.OptsCDRsChargerS] = false
|
||||
cgrEv.APIOpts[utils.OptsAttributeS] = false
|
||||
cgrEv.APIOpts[utils.OptsChargerS] = false
|
||||
if unratedReqs.HasField( // order additional rating for unrated request types
|
||||
engine.MapEvent(cgrEv.Event).GetStringIgnoreErrors(utils.RequestType)) {
|
||||
// argsProc.Flags = append(argsProc.Flags, utils.MetaRALs)
|
||||
@@ -1548,10 +1548,10 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context,
|
||||
}
|
||||
// end of RPC caching
|
||||
|
||||
if !(args.GetAttributes || utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS) ||
|
||||
if !(args.GetAttributes || utils.OptAsBool(args.APIOpts, utils.OptsAttributeS) ||
|
||||
args.GetMaxUsage || utils.OptAsBool(args.APIOpts, utils.OptsSesMaxUsage) ||
|
||||
args.AuthorizeResources || utils.OptAsBool(args.APIOpts, utils.OptsSesResourceSAuthorize) ||
|
||||
args.GetRoutes || utils.OptAsBool(args.APIOpts, utils.OptsSesRouteS)) {
|
||||
args.GetRoutes || utils.OptAsBool(args.APIOpts, utils.OptsRouteS)) {
|
||||
return // Nothing to do
|
||||
}
|
||||
if args.APIOpts == nil {
|
||||
@@ -1559,7 +1559,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
if args.GetAttributes ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsAttributeS) {
|
||||
if args.APIOpts == nil {
|
||||
args.APIOpts = make(map[string]interface{})
|
||||
}
|
||||
@@ -1611,7 +1611,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context,
|
||||
authReply.ResourceAllocation = &allocMsg
|
||||
}
|
||||
if args.GetRoutes ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesRouteS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsRouteS) {
|
||||
args.APIOpts[utils.OptsRoutesMaxCost] = utils.FirstNonEmpty(args.RoutesMaxCost, utils.IfaceAsString(args.APIOpts[utils.OptsSesRouteSMaxCost]))
|
||||
args.APIOpts[utils.OptsRoutesIgnoreErrors] = args.RoutesIgnoreErrors || utils.OptAsBool(args.APIOpts, utils.OptsSesRouteSIgnoreErrors)
|
||||
routesReply, err := sS.getRoutes(ctx, args.CGREvent.Clone())
|
||||
@@ -1623,7 +1623,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context,
|
||||
}
|
||||
}
|
||||
if args.ProcessThresholds ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
var thIDs []string
|
||||
if thIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesThresholdIDs); err != nil {
|
||||
return
|
||||
@@ -1641,7 +1641,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEvent(ctx *context.Context,
|
||||
authReply.ThresholdIDs = &tIDs
|
||||
}
|
||||
if args.ProcessStats ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
var statIDs []string
|
||||
if statIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesStatIDs); err != nil {
|
||||
return
|
||||
@@ -1674,7 +1674,7 @@ func (sS *SessionS) BiRPCv1AuthorizeEventWithDigest(ctx *context.Context,
|
||||
return
|
||||
}
|
||||
if (args.GetAttributes ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS)) && initAuthRply.Attributes != nil {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsAttributeS)) && initAuthRply.Attributes != nil {
|
||||
authReply.AttributesDigest = utils.StringPointer(initAuthRply.Attributes.Digest())
|
||||
}
|
||||
if args.AuthorizeResources ||
|
||||
@@ -1686,16 +1686,16 @@ func (sS *SessionS) BiRPCv1AuthorizeEventWithDigest(ctx *context.Context,
|
||||
authReply.MaxUsage = initAuthRply.MaxUsage.Seconds()
|
||||
}
|
||||
if args.GetRoutes ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesRouteS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsRouteS) {
|
||||
authReply.RoutesDigest = utils.StringPointer(initAuthRply.RouteProfiles.Digest())
|
||||
}
|
||||
if args.ProcessThresholds ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
authReply.Thresholds = utils.StringPointer(
|
||||
strings.Join(*initAuthRply.ThresholdIDs, utils.FieldsSep))
|
||||
}
|
||||
if args.ProcessStats ||
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
authReply.StatQueues = utils.StringPointer(
|
||||
strings.Join(*initAuthRply.StatQueueIDs, utils.FieldsSep))
|
||||
}
|
||||
@@ -1737,7 +1737,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context,
|
||||
// end of RPC caching
|
||||
rply.MaxUsage = utils.DurationPointer(time.Duration(utils.InvalidUsage)) // temp
|
||||
|
||||
attrS := utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS)
|
||||
attrS := utils.OptAsBool(args.APIOpts, utils.OptsAttributeS)
|
||||
initS := utils.OptAsBool(args.APIOpts, utils.OptsSesInitiate)
|
||||
resS := utils.OptAsBool(args.APIOpts, utils.OptsSesResourceSAlocate)
|
||||
if !(attrS || initS || resS) {
|
||||
@@ -1805,7 +1805,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context,
|
||||
rply.MaxUsage = &maxUsage
|
||||
}
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
var thIDs []string
|
||||
if thIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesThresholdIDs); err != nil {
|
||||
return
|
||||
@@ -1819,7 +1819,7 @@ func (sS *SessionS) BiRPCv1InitiateSession(ctx *context.Context,
|
||||
}
|
||||
rply.ThresholdIDs = &tIDs
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
var statIDs []string
|
||||
if statIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesStatIDs); err != nil {
|
||||
return
|
||||
@@ -1902,7 +1902,7 @@ func (sS *SessionS) BiRPCv1UpdateSession(ctx *context.Context,
|
||||
nil, true, utils.NonTransactional)
|
||||
}
|
||||
// end of RPC caching
|
||||
attrS := utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS)
|
||||
attrS := utils.OptAsBool(args.APIOpts, utils.OptsAttributeS)
|
||||
updS := utils.OptAsBool(args.APIOpts, utils.OptsSesUpdate)
|
||||
if !(attrS || updS) {
|
||||
return // nothing to do
|
||||
@@ -2059,7 +2059,7 @@ func (sS *SessionS) BiRPCv1TerminateSession(ctx *context.Context,
|
||||
return utils.NewErrResourceS(err)
|
||||
}
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
var thIDs []string
|
||||
if thIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesThresholdIDs); err != nil {
|
||||
return
|
||||
@@ -2073,7 +2073,7 @@ func (sS *SessionS) BiRPCv1TerminateSession(ctx *context.Context,
|
||||
withErrors = true
|
||||
}
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
var statIDs []string
|
||||
if statIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesStatIDs); err != nil {
|
||||
return
|
||||
@@ -2168,7 +2168,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(ctx *context.Context,
|
||||
me := engine.MapEvent(args.Event)
|
||||
originID := me.GetStringIgnoreErrors(utils.OriginID)
|
||||
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsAttributeS) {
|
||||
rplyAttr, err := sS.processAttributes(ctx, args)
|
||||
if err == nil {
|
||||
args = rplyAttr.CGREvent
|
||||
@@ -2193,7 +2193,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(ctx *context.Context,
|
||||
}
|
||||
rply.ResourceAllocation = &allocMessage
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesRouteS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsRouteS) {
|
||||
routesReply, err := sS.getRoutes(ctx, args.Clone())
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -2209,7 +2209,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(ctx *context.Context,
|
||||
}
|
||||
rply.MaxUsage = &maxUsage
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
var thIDs []string
|
||||
if thIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesThresholdIDs); err != nil {
|
||||
return
|
||||
@@ -2223,7 +2223,7 @@ func (sS *SessionS) BiRPCv1ProcessMessage(ctx *context.Context,
|
||||
}
|
||||
rply.ThresholdIDs = &tIDs
|
||||
}
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
var stIDs []string
|
||||
if stIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesStatIDs); err != nil {
|
||||
return
|
||||
@@ -2284,7 +2284,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
utils.MetaRaw: args,
|
||||
}
|
||||
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesChargerS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsChargerS) {
|
||||
var chrgrs []*engine.ChrgSProcessEventReply
|
||||
if chrgrs, err = sS.processChargerS(ctx, args); err != nil {
|
||||
return
|
||||
@@ -2295,7 +2295,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
// check for *attribute
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsAttributeS) {
|
||||
rply.Attributes = make(map[string]*engine.AttrSProcessEventReply)
|
||||
|
||||
for runID, cgrEv := range getDerivedEvents(events, utils.OptAsBool(args.APIOpts, utils.OptsSesAttributeSDerivedReply)) {
|
||||
@@ -2313,7 +2313,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
// get routes if required
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesRouteS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsRouteS) {
|
||||
rply.RouteProfiles = make(map[string]engine.SortedRoutesList)
|
||||
// check in case we have options for suppliers
|
||||
for runID, cgrEv := range getDerivedEvents(events, utils.OptAsBool(args.APIOpts, utils.OptsSesRouteSDerivedReply)) {
|
||||
@@ -2328,7 +2328,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
// process thresholds if required
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesThresholdS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsThresholdS) {
|
||||
rply.ThresholdIDs = make(map[string][]string)
|
||||
var thIDs []string
|
||||
if thIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesThresholdIDs); err != nil {
|
||||
@@ -2350,7 +2350,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
// process stats if required
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesStatS) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsStatS) {
|
||||
rply.StatQueueIDs = make(map[string][]string)
|
||||
var stIDs []string
|
||||
if stIDs, err = utils.OptAsStringSlice(args.APIOpts, utils.OptsSesStatIDs); err != nil {
|
||||
@@ -2429,7 +2429,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
}
|
||||
|
||||
// check for *resources
|
||||
if opt, has := args.APIOpts[utils.OptsSesResourceS]; has {
|
||||
if opt, has := args.APIOpts[utils.OptsResourceS]; has {
|
||||
if len(sS.cgrCfg.SessionSCfg().ResSConns) == 0 {
|
||||
return utils.NewErrNotConnected(utils.ResourceS)
|
||||
}
|
||||
@@ -2443,7 +2443,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
case utils.MetaRelease:
|
||||
method = utils.ResourceSv1ReleaseResources
|
||||
default:
|
||||
return fmt.Errorf("unsuported value for %s option: %q ", utils.OptsSesResourceS, optStr)
|
||||
return fmt.Errorf("unsuported value for %s option: %q ", utils.OptsResourceS, optStr)
|
||||
}
|
||||
rply.ResourceAllocation = make(map[string]string)
|
||||
for runID, cgrEv := range getDerivedEvents(events, utils.OptAsBool(args.APIOpts, utils.OptsSesResourceSDerivedReply)) {
|
||||
@@ -2609,7 +2609,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(ctx *context.Context,
|
||||
// }
|
||||
// }
|
||||
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsSesCDRs) {
|
||||
if utils.OptAsBool(args.APIOpts, utils.OptsCDRs) {
|
||||
if len(sS.cgrCfg.SessionSCfg().CDRsConns) == 0 {
|
||||
return utils.NewErrNotConnected(utils.CDRs)
|
||||
}
|
||||
@@ -2765,8 +2765,8 @@ func (sS *SessionS) processCDR(ctx *context.Context, cgrEv *utils.CGREvent, rply
|
||||
if cgrEv.APIOpts == nil {
|
||||
cgrEv.APIOpts = make(map[string]interface{})
|
||||
}
|
||||
cgrEv.APIOpts[utils.OptsCDRsAttributeS] = false
|
||||
cgrEv.APIOpts[utils.OptsCDRsChargerS] = false
|
||||
cgrEv.APIOpts[utils.OptsAttributeS] = false
|
||||
cgrEv.APIOpts[utils.OptsChargerS] = false
|
||||
if mp := engine.MapEvent(cgrEv.Event); unratedReqs.HasField(mp.GetStringIgnoreErrors(utils.RequestType)) { // order additional rating for unrated request types
|
||||
// argsProc.Flags = append(argsProc.Flags, fmt.Sprintf("%s:true", utils.MetaRALs))
|
||||
}
|
||||
|
||||
@@ -2110,20 +2110,22 @@ var CGROptionsSet = NewStringSet([]string{OptsRatesRateProfileIDs, OptsRatesStar
|
||||
OptsStirPublicKeyPath, OptsStirPrivateKeyPath, OptsAPIKey, OptsRouteID, OptsContext, OptsAttributesAttributeIDs,
|
||||
OptsAttributesProcessRuns, OptsAttributesProfileRuns, OptsRoutesLimit, OptsRoutesOffset, OptsSesChargeable,
|
||||
RemoteHostOpt, CacheOpt, OptsThresholdsThresholdIDs, OptsRoutesProfileCount, OptsDispatchersProfilesCount,
|
||||
OptsSesAttributeS, OptsSesAttributeIDs, OptsSesAttributeSDerivedReply, OptsSesBlockerError,
|
||||
OptsSesCDRs, OptsSesCDRsDerivedReply, OptsSesChargerS, OptsSesResourceS, OptsSesResourceSAuthorize,
|
||||
OptsSesResourceSAlocate, OptsSesResourceSRelease, OptsSesResourceSDerivedReply, OptsSesRouteS,
|
||||
OptsSesRouteSDerivedReply, OptsSesRouteSIgnoreErrors, OptsSesRouteSMaxCost, OptsSesStatS,
|
||||
OptsAttributeS, OptsSesAttributeSDerivedReply, OptsSesBlockerError,
|
||||
OptsCDRs, OptsSesCDRsDerivedReply, OptsChargerS, OptsResourceS, OptsSesResourceSAuthorize,
|
||||
OptsSesResourceSAlocate, OptsSesResourceSRelease, OptsSesResourceSDerivedReply, OptsRouteS,
|
||||
OptsSesRouteSDerivedReply, OptsSesRouteSIgnoreErrors, OptsSesRouteSMaxCost, OptsStatS,
|
||||
OptsSesStatSDerivedReply, OptsSesStatIDs, OptsSesSTIRAuthenticate, OptsSesSTIRDerivedReply,
|
||||
OptsSesSTIRInitiate, OptsSesThresholdS, OptsSesThresholdSDerivedReply, OptsSesThresholdIDs,
|
||||
OptsSesSTIRInitiate, OptsThresholdS, OptsSesThresholdSDerivedReply, OptsSesThresholdIDs,
|
||||
OptsSesMaxUsage, OptsSesForceDuration, OptsSesInitiate, OptsSesUpdate, OptsSesTerminate,
|
||||
OptsSesMessage, OptsCDRsAttributeS, OptsCDRsChargerS, OptsCDRsExport, OptsCDRsRefund,
|
||||
OptsCDRsRerate, OptsCDRsStatS, OptsCDRsStore, OptsCDRsThresholdS, OptsRateS, OptsAccountS,
|
||||
OptsSesMessage, OptsAttributeS, OptsChargerS, OptsCDRsExport, OptsCDRsRefund,
|
||||
OptsCDRsRerate, OptsStatS, OptsCDRsStore, OptsThresholdS, OptsRateS, OptsAccountS,
|
||||
OptsAccountsUsage, OptsStatsStatIDs, OptsActionsActionProfileIDs})
|
||||
|
||||
// Event Opts
|
||||
const (
|
||||
// SessionS
|
||||
OptsCDRs = "*cdrS"
|
||||
|
||||
OptsSesTTL = "*sesTTL"
|
||||
OptsSesChargeable = "*sesChargeable"
|
||||
OptsSesDebitInterval = "*sesDebitInterval"
|
||||
@@ -2132,29 +2134,23 @@ const (
|
||||
OptsSesTTLMaxDelay = "*sesTTLMaxDelay"
|
||||
OptsSesTTLUsage = "*sesTTLUsage"
|
||||
|
||||
OptsSesAttributeS = "*sesAttributeS"
|
||||
OptsSesAttributeIDs = "*sesAttributeIDs"
|
||||
OptsSesAttributeSDerivedReply = "*sesAttributeSDerivedReply"
|
||||
OptsSesBlockerError = "*sesBlockerError"
|
||||
OptsSesCDRs = "*sesCDRs"
|
||||
OptsSesCDRsDerivedReply = "*sesCDRsDerivedReply"
|
||||
OptsSesChargerS = "*sesChargerS"
|
||||
OptsSesResourceS = "*sesResourceS"
|
||||
OptsResourceS = "*resourceS"
|
||||
OptsSesResourceSAuthorize = "*sesResourceSAuthorize"
|
||||
OptsSesResourceSAlocate = "*sesResourceSAlocate"
|
||||
OptsSesResourceSRelease = "*sesResourceSRelease"
|
||||
OptsSesResourceSDerivedReply = "*sesResourceSDerivedReply"
|
||||
OptsSesRouteS = "*sesRouteS"
|
||||
OptsRouteS = "*routeS"
|
||||
OptsSesRouteSDerivedReply = "*sesRouteSDerivedReply"
|
||||
OptsSesRouteSIgnoreErrors = "*sesRouteSIgnoreErrors"
|
||||
OptsSesRouteSMaxCost = "*sesRouteSMaxCost"
|
||||
OptsSesStatS = "*sesStatS"
|
||||
OptsSesStatSDerivedReply = "*sesStatSDerivedReply"
|
||||
OptsSesStatIDs = "*sesStatIDs"
|
||||
OptsSesSTIRAuthenticate = "*sesSTIRAuthenticate"
|
||||
OptsSesSTIRDerivedReply = "*sesSTIRDerivedReply"
|
||||
OptsSesSTIRInitiate = "*sesSTIRInitiate"
|
||||
OptsSesThresholdS = "*sesThresholdS"
|
||||
OptsSesThresholdSDerivedReply = "*sesThresholdSDerivedReply"
|
||||
OptsSesThresholdIDs = "*sesThresholdIDs"
|
||||
OptsSesMaxUsage = "*sesMaxUsage"
|
||||
@@ -2178,15 +2174,16 @@ const (
|
||||
OptsAttributesProcessRuns = "*attrProcessRuns"
|
||||
|
||||
// CDRs
|
||||
OptsCDRsAttributeS = "*cdrsAttributeS"
|
||||
OptsCDRsChargerS = "*cdrsChargerS"
|
||||
OptsCDRsExport = "*cdrsExport"
|
||||
OptsCDRsRefund = "*cdrsRefund"
|
||||
OptsCDRsRerate = "*cdrsRerate"
|
||||
OptsCDRsStatS = "*cdrsStatS"
|
||||
OptsCDRsStore = "*cdrsStore"
|
||||
OptsCDRsThresholdS = "*cdrsThresholdS"
|
||||
OptsRateS = "*rateS"
|
||||
OptsAttributeS = "*attributeS"
|
||||
OptsChargerS = "*chargerS"
|
||||
OptsStatS = "*statS"
|
||||
OptsThresholdS = "*thresholdS"
|
||||
OptsRateS = "*rateS"
|
||||
|
||||
OptsCDRsExport = "*cdrsExport"
|
||||
OptsCDRsRefund = "*cdrsRefund"
|
||||
OptsCDRsRerate = "*cdrsRerate"
|
||||
OptsCDRsStore = "*cdrsStore"
|
||||
|
||||
// DispatcherS
|
||||
OptsAPIKey = "*apiKey"
|
||||
|
||||
Reference in New Issue
Block a user