From 2ba3ce8ca3751f0a756a4927e246b14e7263dbc9 Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Thu, 16 Jul 2015 19:42:51 +0300 Subject: [PATCH] fixing and logging --- sessionmanager/session.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sessionmanager/session.go b/sessionmanager/session.go index 347ff450f..1817a029f 100644 --- a/sessionmanager/session.go +++ b/sessionmanager/session.go @@ -100,7 +100,7 @@ func (s *Session) debitLoop(runIdx int) { } s.sessionRuns[runIdx].CallCosts = append(s.sessionRuns[runIdx].CallCosts, cc) engine.Logger.Debug(fmt.Sprintf("CALLCOST: %s", utils.ToJSON(cc))) - engine.Logger.Debug(fmt.Sprintf("NEXTCD: %s DURATION: %s", utils.ToJSON(cc), nextCd.GetDuration().String())) + engine.Logger.Debug(fmt.Sprintf("NEXTCD: %s DURATION: %s", utils.ToJSON(cd), nextCd.GetDuration().String())) nextCd.TimeEnd = cc.GetEndTime() // set debited timeEnd // update call duration with real debited duration nextCd.DurationIndex -= debitPeriod @@ -169,6 +169,8 @@ func (s *Session) Refund(lastCC *engine.CallCost, hangupTime time.Time) error { refundIncrements = append(refundIncrements, increment) refundDuration -= increment.Duration lastRefundedIncrementIndex = j + } else { + break //increment duration is larger, cannot refund increment } } if lastRefundedIncrementIndex == 0 {