engine.Responder with ProcessCdr method, moved cdrs and mediator to engine

This commit is contained in:
DanB
2014-07-25 17:44:50 +02:00
parent 19e994ca8a
commit e93b8a6c6f
19 changed files with 266 additions and 325 deletions

View File

@@ -36,6 +36,7 @@ import (
type Responder struct {
Bal *balancer2go.Balancer
ExitChan chan bool
CdrSrv *CDRS
}
/*
@@ -128,6 +129,17 @@ func (rs *Responder) GetDerivedChargers(attrs utils.AttrDerivedChargers, dcs *ut
return nil
}
func (rs *Responder) ProcessCdr(cdr *utils.StoredCdr, reply *string) error {
if rs.CdrSrv == nil {
return errors.New("CdrServerNotRunning")
}
if err := rs.CdrSrv.ProcessCdr(cdr); err != nil {
return err
}
*reply = utils.OK
return nil
}
func (rs *Responder) FlushCache(arg CallDescriptor, reply *float64) (err error) {
if rs.Bal != nil {
*reply, err = rs.callMethod(&arg, "Responder.FlushCache")
@@ -287,6 +299,7 @@ type Connector interface {
RefundIncrements(CallDescriptor, *float64) error
GetMaxSessionTime(CallDescriptor, *float64) error
GetDerivedChargers(utils.AttrDerivedChargers, *utils.DerivedChargers) error
ProcessCdr(*utils.StoredCdr, *string) error
}
type RPCClientConnector struct {
@@ -316,3 +329,7 @@ func (rcc *RPCClientConnector) GetMaxSessionTime(cd CallDescriptor, resp *float6
func (rcc *RPCClientConnector) GetDerivedChargers(attrs utils.AttrDerivedChargers, dcs *utils.DerivedChargers) error {
return rcc.Client.Call("ApierV1.GetDerivedChargers", attrs, dcs)
}
func (rcc *RPCClientConnector) ProcessCdr(cdr *utils.StoredCdr, reply *string) error {
return rcc.Client.Call("CDRSV1.ProcessCdr", cdr, reply)
}