diff --git a/console/command_executer.go b/console/command_executer.go index 1aebcf316..5a61c75ad 100644 --- a/console/command_executer.go +++ b/console/command_executer.go @@ -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 } diff --git a/console/cost.go b/console/cost.go index f6d59e14f..ab5753813 100644 --- a/console/cost.go +++ b/console/cost.go @@ -18,13 +18,17 @@ along with this program. If not, see 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 { diff --git a/data/conf/samples/tutmysql/cgrates.json b/data/conf/samples/tutmysql/cgrates.json index 0c61e4f56..e76f51945 100644 --- a/data/conf/samples/tutmysql/cgrates.json +++ b/data/conf/samples/tutmysql/cgrates.json @@ -5,6 +5,7 @@ "general": { "log_level": 7, + "logger":"*stdout", },