Use CompressFactor in SessionS.Refund

This commit is contained in:
TeoV
2019-03-04 18:28:59 +02:00
committed by Dan Christian Bogos
parent 9214301de3
commit 65b8c56256
2 changed files with 5 additions and 3 deletions

View File

@@ -575,7 +575,10 @@ func (sS *SessionS) refundSession(s *Session, sRunIdx int, rUsage time.Duration)
incr.BalanceInfo.Monetary == nil) {
continue // not enough information for refunds, most probably free units uncounted
}
incrmts = append(incrmts, incr)
for i := 0; i < tmspn.CompressFactor; i++ {
incrmts = append(incrmts, incr)
}
}
}
cd := &engine.CallDescriptor{

View File

@@ -873,14 +873,13 @@ func TestSessionsVoiceSessionTTL(t *testing.T) {
t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue())
}
time.Sleep(100 * time.Millisecond)
eAcntVal = 4.0565
eAcntVal = 4.0566
if err := sessionsRPC.Call("ApierV2.GetAccount", attrs, &acnt); err != nil {
t.Error(err)
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal {
t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue())
}
time.Sleep(time.Duration(500 * time.Millisecond))
var cdrs []*engine.ExternalCDR
req := utils.RPCCDRsFilter{RunIDs: []string{utils.META_DEFAULT}, DestinationPrefixes: []string{"1008"}}
if err := sessionsRPC.Call(utils.ApierV2GetCDRs, req, &cdrs); err != nil {