mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 06:09:53 +05:00
fixed debit loop callend issue
This commit is contained in:
@@ -67,6 +67,13 @@ func (cc *CallCost) GetStartTime() time.Time {
|
||||
return cc.Timespans[0].TimeStart
|
||||
}
|
||||
|
||||
func (cc *CallCost) GetEndTime() time.Time {
|
||||
if len(cc.Timespans) == 0 {
|
||||
return time.Now()
|
||||
}
|
||||
return cc.Timespans[len(cc.Timespans)-1].TimeEnd
|
||||
}
|
||||
|
||||
func (cc *CallCost) GetDuration() (td time.Duration) {
|
||||
for _, ts := range cc.Timespans {
|
||||
td += ts.GetDuration()
|
||||
|
||||
@@ -20,9 +20,10 @@ package sessionmanager
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/cgrates/cgrates/engine"
|
||||
"github.com/cgrates/cgrates/utils"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Session type holding the call information fields, a session delegate for specific
|
||||
@@ -87,6 +88,7 @@ func (s *Session) startDebitLoop() {
|
||||
}
|
||||
nextCd.TimeEnd = nextCd.TimeStart.Add(s.sessionManager.GetDebitPeriod())
|
||||
cc := s.sessionManager.LoopAction(s, &nextCd, index)
|
||||
nextCd.TimeEnd = cc.GetEndTime()
|
||||
time.Sleep(cc.GetDuration())
|
||||
index++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user