mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Replacing console cost to point towards ApierV1.GetCost
This commit is contained in:
committed by
Dan Christian Bogos
parent
8f7834f247
commit
b5a0d2d150
@@ -22,6 +22,7 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"log"
|
||||
"reflect"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -67,7 +68,7 @@ func (ce *CommandExecuter) clientArgs(iface interface{}) (args []string) {
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
valField := val.Field(i)
|
||||
typeField := typ.Field(i)
|
||||
//log.Printf("%v (%v : %v)", typeField.Name, valField.Kind(), typeField.PkgPath)
|
||||
log.Printf("%v (%v : %v)", typeField.Name, valField.Kind(), typeField.PkgPath)
|
||||
if len(typeField.PkgPath) > 0 { //unexported field
|
||||
continue
|
||||
}
|
||||
@@ -76,7 +77,7 @@ func (ce *CommandExecuter) clientArgs(iface interface{}) (args []string) {
|
||||
if valField.Kind() == reflect.Ptr {
|
||||
valField = reflect.New(valField.Type().Elem()).Elem()
|
||||
if valField.Kind() != reflect.Struct {
|
||||
//log.Printf("Here: %v (%v)", typeField.Name, valField.Kind())
|
||||
log.Printf("Here: %v (%v)", typeField.Name, valField.Kind())
|
||||
args = append(args, typeField.Name)
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -18,13 +18,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
|
||||
package console
|
||||
|
||||
import "github.com/cgrates/cgrates/engine"
|
||||
import (
|
||||
"github.com/cgrates/cgrates/apier/v1"
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
)
|
||||
|
||||
func init() {
|
||||
c := &CmdGetCost{
|
||||
name: "cost",
|
||||
rpcMethod: "Responder.GetCost",
|
||||
clientArgs: []string{"Direction", "Category", "TOR", "Tenant", "Subject", "Account", "Destination", "TimeStart", "TimeEnd", "CallDuration", "FallbackSubject"},
|
||||
rpcMethod: "ApierV1.GetCost",
|
||||
clientArgs: []string{"Tenant", "Category", "Subject", "AnswerTime", "Destination", "Usage"},
|
||||
rpcParams: &v1.AttrGetCost{},
|
||||
}
|
||||
commands[c.Name()] = c
|
||||
c.CommandExecuter = &CommandExecuter{c}
|
||||
@@ -34,7 +38,7 @@ func init() {
|
||||
type CmdGetCost struct {
|
||||
name string
|
||||
rpcMethod string
|
||||
rpcParams *engine.CallDescriptor
|
||||
rpcParams *v1.AttrGetCost
|
||||
clientArgs []string
|
||||
*CommandExecuter
|
||||
}
|
||||
@@ -49,7 +53,7 @@ func (self *CmdGetCost) RpcMethod() string {
|
||||
|
||||
func (self *CmdGetCost) RpcParams(reset bool) interface{} {
|
||||
if reset || self.rpcParams == nil {
|
||||
self.rpcParams = &engine.CallDescriptor{Direction: "*out"}
|
||||
self.rpcParams = &v1.AttrGetCost{}
|
||||
}
|
||||
return self.rpcParams
|
||||
}
|
||||
@@ -59,7 +63,7 @@ func (self *CmdGetCost) PostprocessRpcParams() error {
|
||||
}
|
||||
|
||||
func (self *CmdGetCost) RpcResult() interface{} {
|
||||
return &engine.CallCost{}
|
||||
return &engine.EventCost{}
|
||||
}
|
||||
|
||||
func (self *CmdGetCost) ClientArgs() []string {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
"general": {
|
||||
"log_level": 7,
|
||||
"logger":"*stdout",
|
||||
},
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user