mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 13:19:53 +05:00
added matched subject and matched prefix to timespan
This commit is contained in:
@@ -284,6 +284,8 @@ func (cd *CallDescriptor) splitInTimeSpans(firstSpan *TimeSpan) (timespans []*Ti
|
||||
for _, rp := range cd.RatingInfos {
|
||||
if !afterStart && !afterEnd && rp.ActivationTime.Before(cd.TimeStart) {
|
||||
firstSpan.ratingInfo = rp
|
||||
firstSpan.MatchedSubject = rp.MatchedSubject
|
||||
firstSpan.MatchedPrefix = rp.MatchedPrefix
|
||||
} else {
|
||||
afterStart = true
|
||||
for i := 0; i < len(timespans); i++ {
|
||||
@@ -399,14 +401,10 @@ func (cd *CallDescriptor) GetCost() (*CallCost, error) {
|
||||
cost = utils.Round(cost, roundingDecimals, roundingMethod)
|
||||
//startIndex := len(fmt.Sprintf("%s:%s:%s:", cd.Direction, cd.Tenant, cd.TOR))
|
||||
cc := &CallCost{
|
||||
Direction: cd.Direction,
|
||||
TOR: cd.TOR,
|
||||
Tenant: cd.Tenant,
|
||||
// TODO, FIXME: find out where to put matched subject
|
||||
//Subject: matchedSubject[startIndex:],
|
||||
Account: cd.Account,
|
||||
// TODO, FIXME: find out where to put matched prfixes
|
||||
//Destination: strings.Join(destPrefix, ";"),
|
||||
Direction: cd.Direction,
|
||||
TOR: cd.TOR,
|
||||
Tenant: cd.Tenant,
|
||||
Account: cd.Account,
|
||||
Cost: cost,
|
||||
ConnectFee: connectionFee,
|
||||
Timespans: timespans}
|
||||
|
||||
@@ -28,13 +28,14 @@ import (
|
||||
A unit in which a call will be split that has a specific price related interval attached to it.
|
||||
*/
|
||||
type TimeSpan struct {
|
||||
TimeStart, TimeEnd time.Time
|
||||
Cost float64
|
||||
ratingInfo *RatingInfo
|
||||
RateInterval *RateInterval
|
||||
CallDuration time.Duration // the call duration so far till TimeEnd
|
||||
overlapped bool // mark a timespan as overlapped by an expanded one
|
||||
Increments Increments
|
||||
TimeStart, TimeEnd time.Time
|
||||
Cost float64
|
||||
ratingInfo *RatingInfo
|
||||
RateInterval *RateInterval
|
||||
CallDuration time.Duration // the call duration so far till TimeEnd
|
||||
overlapped bool // mark a timespan as overlapped by an expanded one
|
||||
Increments Increments
|
||||
MatchedSubject, MatchedPrefix string
|
||||
}
|
||||
|
||||
type Increment struct {
|
||||
@@ -259,7 +260,13 @@ func (ts *TimeSpan) SplitByRatingPlan(rp *RatingInfo) (newTs *TimeSpan) {
|
||||
if !ts.Contains(rp.ActivationTime) {
|
||||
return nil
|
||||
}
|
||||
newTs = &TimeSpan{TimeStart: rp.ActivationTime, TimeEnd: ts.TimeEnd, ratingInfo: rp}
|
||||
newTs = &TimeSpan{
|
||||
TimeStart: rp.ActivationTime,
|
||||
TimeEnd: ts.TimeEnd,
|
||||
ratingInfo: rp,
|
||||
MatchedSubject: rp.MatchedSubject,
|
||||
MatchedPrefix: rp.MatchedPrefix,
|
||||
}
|
||||
newTs.CallDuration = ts.CallDuration
|
||||
ts.TimeEnd = rp.ActivationTime
|
||||
ts.SetNewCallDuration(newTs)
|
||||
|
||||
Reference in New Issue
Block a user