mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 14:19:54 +05:00
Console active_sessions API update
This commit is contained in:
committed by
Dan Christian Bogos
parent
3d88a3ef00
commit
89a181bf12
@@ -43,6 +43,7 @@ func (ssv1 *SessionSv1) Handlers() map[string]interface{} {
|
||||
utils.SessionSv1TerminateSession: ssv1.BiRpcTerminateSession,
|
||||
utils.SessionSv1ProcessCDR: ssv1.BiRpcProcessCDR,
|
||||
utils.SessionSv1ProcessEvent: ssv1.BiRpcProcessEvent,
|
||||
utils.SessionSv1GetActiveSessions: ssv1.BiRPCV1GetActiveSessions,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +81,10 @@ func (ssv1 *SessionSv1) ProcessEvent(args *sessionmanager.V1ProcessEventArgs,
|
||||
return ssv1.SMG.BiRPCv1ProcessEvent(nil, args, rply)
|
||||
}
|
||||
|
||||
func (ssv1 *SessionSv1) GetActiveSessions(args map[string]string, rply *[]*sessionmanager.ActiveSession) error {
|
||||
return ssv1.SMG.BiRPCV1GetActiveSessions(nil, args, rply)
|
||||
}
|
||||
|
||||
func (ssv1 *SessionSv1) BiRpcAuthorizeEvent(clnt *rpc2.Client, args *sessionmanager.V1AuthorizeArgs,
|
||||
rply *sessionmanager.V1AuthorizeReply) error {
|
||||
return ssv1.SMG.BiRPCv1AuthorizeEvent(clnt, args, rply)
|
||||
@@ -113,3 +118,8 @@ func (ssv1 *SessionSv1) BiRpcProcessEvent(clnt *rpc2.Client, args *sessionmanage
|
||||
rply *sessionmanager.V1ProcessEventReply) error {
|
||||
return ssv1.SMG.BiRPCv1ProcessEvent(clnt, args, rply)
|
||||
}
|
||||
|
||||
func (ssv1 *SessionSv1) BiRPCV1GetActiveSessions(clnt *rpc2.Client, args map[string]string,
|
||||
rply *[]*sessionmanager.ActiveSession) error {
|
||||
return ssv1.SMG.BiRPCV1GetActiveSessions(clnt, args, rply)
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
func init() {
|
||||
c := &CmdActiveSessions{
|
||||
name: "active_sessions",
|
||||
rpcMethod: "SessionManagerV1.ActiveSessions",
|
||||
rpcMethod: utils.SessionSv1GetActiveSessions,
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -36,7 +36,7 @@ func init() {
|
||||
type CmdActiveSessions struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *utils.AttrGetSMASessions
|
||||
rpcParams interface{}
|
||||
*CommandExecuter
|
||||
}
|
||||
|
||||
@@ -50,12 +50,14 @@ func (self *CmdActiveSessions) RpcMethod() string {
|
||||
|
||||
func (self *CmdActiveSessions) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &utils.AttrGetSMASessions{}
|
||||
self.rpcParams = &map[string]string{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
|
||||
func (self *CmdActiveSessions) PostprocessRpcParams() error {
|
||||
param := self.rpcParams.(*map[string]string)
|
||||
self.rpcParams = param
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@ func (ce *CommandExecuter) LocalExecute() string {
|
||||
}
|
||||
|
||||
func ToJSON(line string) (jsn []byte) {
|
||||
if !strings.Contains(line, "=") {
|
||||
line = fmt.Sprintf("Item=\"%s\"", line)
|
||||
}
|
||||
// if !strings.Contains(line, "=") {
|
||||
// line = fmt.Sprintf("Item=\"%s\"", line)
|
||||
// }
|
||||
jsn = append(jsn, '{')
|
||||
for _, group := range lineR.FindAllStringSubmatch(line, -1) {
|
||||
if len(group) == 3 {
|
||||
|
||||
@@ -603,6 +603,7 @@ const (
|
||||
SessionSv1ProcessCDR = "SessionSv1.ProcessCDR"
|
||||
SessionSv1ProcessEvent = "SessionSv1.ProcessEvent"
|
||||
SessionSv1DisconnectSession = "SessionSv1.DisconnectSession"
|
||||
SessionSv1GetActiveSessions = "SessionSv1.GetActiveSessions"
|
||||
SMGenericV1InitiateSession = "SMGenericV1.InitiateSession"
|
||||
SMGenericV2InitiateSession = "SMGenericV2.InitiateSession"
|
||||
SMGenericV2UpdateSession = "SMGenericV2.UpdateSession"
|
||||
|
||||
Reference in New Issue
Block a user