diff --git a/engine/calldesc.go b/engine/calldesc.go index 5f25cc15f..1b4aac0de 100644 --- a/engine/calldesc.go +++ b/engine/calldesc.go @@ -303,11 +303,12 @@ func (cd *CallDescriptor) GetCost() (*CallCost, error) { } // global rounding cost = utils.Round(cost, roundingDecimals, roundingMethod) + subject := strings.Split(matchedSubject, ":") cc := &CallCost{ Direction: cd.Direction, TOR: cd.TOR, Tenant: cd.Tenant, - Subject: matchedSubject, + Subject: subject[len(subject)-1], Account: cd.Account, Destination: destPrefix, Cost: cost, diff --git a/mediator/mediator.go b/mediator/mediator.go index 36407fe8c..3dd761c22 100644 --- a/mediator/mediator.go +++ b/mediator/mediator.go @@ -199,7 +199,10 @@ func (self *Mediator) getCostsFromRater(cdr utils.CDR) (*engine.CallCost, error) Account: cdr.GetAccount(), Destination: cdr.GetDestination(), TimeStart: t1, - TimeEnd: t1.Add(d)} + TimeEnd: t1.Add(d), + LoopIndex: 0, + } + cd.CallDuration = cd.TimeEnd.Sub(cd.TimeStart) if cdr.GetReqType() == utils.PSEUDOPREPAID { err = self.connector.Debit(cd, cc) } else {