Added sleep and ping API on DispatcherSv1

This commit is contained in:
andronache
2021-07-06 17:04:20 +03:00
committed by Dan Christian Bogos
parent 3cb7081792
commit 8917043055
3 changed files with 41 additions and 0 deletions

View File

@@ -265,3 +265,11 @@ func (dSv1 DispatcherSv1) GetProfilesForEvent(ctx *context.Context, ev *utils.CG
func (dS *DispatcherSv1) RemoteStatus(args *utils.TenantWithAPIOpts, reply *map[string]interface{}) (err error) {
return dS.dS.DispatcherSv1RemoteStatus(args, reply)
}
func (dS *DispatcherSv1) RemotePing(args *utils.CGREvent, reply *string) (err error) {
return dS.dS.DispatcherSv1RemotePing(args, reply)
}
func (dS *DispatcherSv1) RemoteSleep(args *utils.DurationArgs, reply *string) (err error) {
return dS.dS.DispatcherSv1RemoteSleep(args, reply)
}

View File

@@ -245,3 +245,34 @@ func (dS *DispatcherService) DispatcherSv1RemoteStatus(args *utils.TenantWithAPI
APIOpts: args.APIOpts,
}, utils.MetaCore, utils.CoreSv1Status, args, reply)
}
func (dS *DispatcherService) DispatcherSv1RemoteSleep(args *utils.DurationArgs, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args.Tenant != utils.EmptyString {
tnt = args.Tenant
}
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.CoreSv1Sleep, tnt,
utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey])); err != nil {
return
}
}
return dS.Dispatch(context.Background(), &utils.CGREvent{
Tenant: tnt,
APIOpts: args.APIOpts,
}, utils.MetaCore, utils.CoreSv1Sleep, args, reply)
}
func (dS *DispatcherService) DispatcherSv1RemotePing(args *utils.CGREvent, reply *string) (err error) {
tnt := dS.cfg.GeneralCfg().DefaultTenant
if args != nil && args.Tenant != utils.EmptyString {
tnt = args.Tenant
}
if len(dS.cfg.DispatcherSCfg().AttributeSConns) != 0 {
if err = dS.authorize(utils.CoreSv1Ping, tnt,
utils.IfaceAsString(args.APIOpts[utils.OptsAPIKey]), args.Time); err != nil {
return
}
}
return dS.Dispatch(context.Background(), args, utils.MetaCore, utils.CoreSv1Ping, args, reply)
}

View File

@@ -1425,6 +1425,8 @@ const (
DispatcherSv1GetProfilesForEvent = "DispatcherSv1.GetProfilesForEvent"
DispatcherServicePing = "DispatcherService.Ping"
DispatcherSv1RemoteStatus = "DispatcherSv1.RemoteStatus"
DispatcherSv1RemoteSleep = "DispatcherSv1.RemoteSleep"
DispatcherSv1RemotePing = "DispatcherSv1.RemotePing"
)
// RegistrarS APIs