passing call test

This commit is contained in:
Radu Ioan Fericean
2016-04-19 18:14:44 +03:00
parent f08524837a
commit c174605ab8
2 changed files with 3 additions and 6 deletions

View File

@@ -22,7 +22,6 @@ import (
"encoding/json"
"errors"
"fmt"
"log"
"net/smtp"
"path"
"reflect"
@@ -680,12 +679,10 @@ func cgrRPCAction(account *Account, sq *StatsQueueTriggered, a *Action, acs Acti
}
in, out := params.InParam, params.OutParam
log.Print("IN: ", reflect.TypeOf(in))
log.Print(req.Param)
if err := json.Unmarshal([]byte(req.Param), &in); err != nil {
x := in
if err := json.Unmarshal([]byte(req.Param), &x); err != nil {
return err
}
log.Print("IN: ", reflect.TypeOf(in))
return client.Call(req.Method, in, out)
}

View File

@@ -33,7 +33,7 @@ func RegisterRpcParams(name string, obj rpcclient.RpcClientConnection) {
if methodType.NumIn() == 3 { // if it has three parameters (one is self and two are rpc params)
rpcParamsMap[name+"."+method.Name] = &RpcParams{
Object: obj,
InParam: reflect.Zero(methodType.In(1)).Interface(),
InParam: (reflect.New(methodType.In(1)).Elem()).Interface(),
OutParam: reflect.New(methodType.In(2).Elem()).Interface(),
}
}