mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Changed ping strings to lower case, added sessionSv1 commands to console.
This commit is contained in:
committed by
Dan Christian Bogos
parent
5bc107fecf
commit
1703277205
@@ -20,6 +20,7 @@ package console
|
||||
|
||||
import (
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -48,21 +49,21 @@ func (self *CmdApierPing) Name() string {
|
||||
|
||||
func (self *CmdApierPing) RpcMethod() string {
|
||||
switch self.rpcParams.Item {
|
||||
case utils.SupplierS:
|
||||
case strings.ToLower(utils.SupplierS):
|
||||
return utils.SupplierSv1Ping
|
||||
case utils.AttributeS:
|
||||
case strings.ToLower(utils.AttributeS):
|
||||
return utils.AttributeSv1Ping
|
||||
case utils.ResourceS:
|
||||
case strings.ToLower(utils.ResourceS):
|
||||
return utils.ResourceSv1Ping
|
||||
case utils.StatService:
|
||||
case strings.ToLower(utils.StatService):
|
||||
return utils.StatSv1Ping
|
||||
case utils.ThresholdS:
|
||||
case strings.ToLower(utils.ThresholdS):
|
||||
return utils.ThresholdSv1Ping
|
||||
case utils.SessionS:
|
||||
case strings.ToLower(utils.SessionS):
|
||||
return utils.SessionSv1Ping
|
||||
case utils.LoaderS:
|
||||
case strings.ToLower(utils.LoaderS):
|
||||
return utils.LoaderSv1Ping
|
||||
case utils.DispatcherS:
|
||||
case strings.ToLower(utils.DispatcherS):
|
||||
return utils.DispatcherSv1Ping
|
||||
default:
|
||||
}
|
||||
|
||||
70
console/session_authorize_event.go
Normal file
70
console/session_authorize_event.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsAuthorize{
|
||||
name: "session_authorize_event",
|
||||
rpcMethod: utils.SessionSv1AuthorizeEventWithDigest,
|
||||
rpcParams: &sessions.V1AuthorizeArgs{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsAuthorize struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *sessions.V1AuthorizeArgs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsAuthorize) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsAuthorize) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsAuthorize) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &sessions.V1AuthorizeArgs{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsAuthorize) PostprocessRpcParams() error {
|
||||
if self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsAuthorize) RpcResult() interface{} {
|
||||
var atr *sessions.V1AuthorizeReplyWithDigest
|
||||
return &atr
|
||||
}
|
||||
70
console/session_initiate.go
Normal file
70
console/session_initiate.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsInitiate{
|
||||
name: "session_initiate",
|
||||
rpcMethod: utils.SessionSv1InitiateSession,
|
||||
rpcParams: &sessions.V1InitSessionArgs{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsInitiate struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *sessions.V1InitSessionArgs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsInitiate) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsInitiate) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsInitiate) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &sessions.V1InitSessionArgs{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsInitiate) PostprocessRpcParams() error {
|
||||
if self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsInitiate) RpcResult() interface{} {
|
||||
var atr *sessions.V1InitSessionReply
|
||||
return &atr
|
||||
}
|
||||
70
console/session_process_cdr.go
Normal file
70
console/session_process_cdr.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
// "github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsProcessCDR{
|
||||
name: "session_process_cdr",
|
||||
rpcMethod: utils.SessionSv1ProcessCDR,
|
||||
rpcParams: &utils.CGREvent{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsProcessCDR struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.CGREvent
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessCDR) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessCDR) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessCDR) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.CGREvent{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessCDR) PostprocessRpcParams() error {
|
||||
if self.rpcParams.Time == nil {
|
||||
self.rpcParams.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessCDR) RpcResult() interface{} {
|
||||
var atr *string
|
||||
return &atr
|
||||
}
|
||||
70
console/session_process_event.go
Normal file
70
console/session_process_event.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsProcessEvent{
|
||||
name: "session_process_event",
|
||||
rpcMethod: utils.SessionSv1ProcessEvent,
|
||||
rpcParams: &sessions.V1ProcessEventArgs{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsProcessEvent struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *sessions.V1ProcessEventArgs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessEvent) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessEvent) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessEvent) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &sessions.V1ProcessEventArgs{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessEvent) PostprocessRpcParams() error {
|
||||
if self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsProcessEvent) RpcResult() interface{} {
|
||||
var atr *sessions.V1ProcessEventReply
|
||||
return &atr
|
||||
}
|
||||
70
console/session_terminate.go
Normal file
70
console/session_terminate.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsTerminate{
|
||||
name: "session_terminate",
|
||||
rpcMethod: utils.SessionSv1TerminateSession,
|
||||
rpcParams: &sessions.V1TerminateSessionArgs{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsTerminate struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *sessions.V1TerminateSessionArgs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsTerminate) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsTerminate) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsTerminate) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &sessions.V1TerminateSessionArgs{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsTerminate) PostprocessRpcParams() error {
|
||||
if self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsTerminate) RpcResult() interface{} {
|
||||
var atr *string
|
||||
return &atr
|
||||
}
|
||||
70
console/session_update.go
Normal file
70
console/session_update.go
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Real-time Online/Offline Charging System (OCS) for Telecom & ISP environments
|
||||
Copyright (C) ITsysCOM GmbH
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package console
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/sessions"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdSessionsUpdate{
|
||||
name: "session_update",
|
||||
rpcMethod: utils.SessionSv1UpdateSession,
|
||||
rpcParams: &sessions.V1UpdateSessionArgs{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
}
|
||||
|
||||
type CmdSessionsUpdate struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *sessions.V1UpdateSessionArgs
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
func (self *CmdSessionsUpdate) Name() string {
|
||||
return self.name
|
||||
}
|
||||
|
||||
func (self *CmdSessionsUpdate) RpcMethod() string {
|
||||
return self.rpcMethod
|
||||
}
|
||||
|
||||
func (self *CmdSessionsUpdate) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &sessions.V1UpdateSessionArgs{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdSessionsUpdate) PostprocessRpcParams() error {
|
||||
if self.rpcParams.CGREvent.Time == nil {
|
||||
self.rpcParams.CGREvent.Time = utils.TimePointer(time.Now())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (self *CmdSessionsUpdate) RpcResult() interface{} {
|
||||
var atr *sessions.V1UpdateSessionReply
|
||||
return &atr
|
||||
}
|
||||
@@ -292,6 +292,18 @@
|
||||
|
||||
"sessions": {
|
||||
"enabled": true,
|
||||
"suppliers_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"resources_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"attributes_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
"rals_conns": [
|
||||
{"address": "*internal"}
|
||||
],
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user