mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-15 21:29:52 +05:00
Merge branch 'master' of https://github.com/cgrates/cgrates
This commit is contained in:
@@ -133,7 +133,8 @@ func (cc *CallCost) ToDataCost() (*DataCost, error) {
|
||||
DataIndex: callDuration,
|
||||
MatchedSubject: ts.MatchedSubject,
|
||||
MatchedPrefix: ts.MatchedPrefix,
|
||||
MatchedDestId: ts.MatchedDestId,
|
||||
MatchedDestID: ts.MatchedDestID,
|
||||
RatingPlanID: ts.RatingPlanID,
|
||||
}
|
||||
dc.DataSpans[i].Increments = make([]*DataIncrement, len(ts.Increments))
|
||||
for j, incr := range ts.Increments {
|
||||
|
||||
@@ -890,7 +890,7 @@ func (cd *CallDescriptor) GetLCR(stats StatsInterface) (*LCRCost, error) {
|
||||
// Supplier: supplier,
|
||||
// Error: err,
|
||||
//})
|
||||
Logger.Warning(fmt.Sprintf("LCR_WARNING: Ignoring supplier: %s, cannot calculate cost, error: %v", err))
|
||||
Logger.Warning(fmt.Sprintf("LCR_WARNING: Ignoring supplier: %s, cannot calculate cost, error: %v", supplier, err))
|
||||
continue
|
||||
} else {
|
||||
supplCost := &LCRSupplierCost{
|
||||
|
||||
@@ -133,7 +133,7 @@ func TestSplitSpansWeekend(t *testing.T) {
|
||||
&RatingInfo{
|
||||
MatchedSubject: "*out:foehn:postpaid:foehn",
|
||||
MatchedPrefix: "0034678",
|
||||
MatchedDestId: "SPN_MOB",
|
||||
MatchedDestID: "SPN_MOB",
|
||||
ActivationTime: time.Date(2015, 4, 23, 0, 0, 0, 0, time.UTC),
|
||||
RateIntervals: []*RateInterval{
|
||||
&RateInterval{
|
||||
|
||||
@@ -25,13 +25,13 @@ type DataCost struct {
|
||||
deductConnectFee bool
|
||||
}
|
||||
type DataSpan struct {
|
||||
DataStart, DataEnd float64
|
||||
Cost float64
|
||||
ratingInfo *RatingInfo
|
||||
RateInterval *RateInterval
|
||||
DataIndex float64 // the data transfer so far till DataEnd
|
||||
Increments []*DataIncrement
|
||||
MatchedSubject, MatchedPrefix, MatchedDestId string
|
||||
DataStart, DataEnd float64
|
||||
Cost float64
|
||||
ratingInfo *RatingInfo
|
||||
RateInterval *RateInterval
|
||||
DataIndex float64 // the data transfer so far till DataEnd
|
||||
Increments []*DataIncrement
|
||||
MatchedSubject, MatchedPrefix, MatchedDestID, RatingPlanID string
|
||||
}
|
||||
|
||||
type DataIncrement struct {
|
||||
|
||||
@@ -82,8 +82,9 @@ func (rpas RatingPlanActivations) GetActiveForCall(cd *CallDescriptor) RatingPla
|
||||
|
||||
type RatingInfo struct {
|
||||
MatchedSubject string
|
||||
RatingPlanID string
|
||||
MatchedPrefix string
|
||||
MatchedDestId string
|
||||
MatchedDestID string
|
||||
ActivationTime time.Time
|
||||
RateIntervals RateIntervalList
|
||||
FallbackKeys []string
|
||||
@@ -159,15 +160,36 @@ func (rp *RatingProfile) GetRatingPlansForPrefix(cd *CallDescriptor) (err error)
|
||||
}
|
||||
// check if it's the first ri and add a blank one for the initial part not covered
|
||||
if index == 0 && cd.TimeStart.Before(rpa.ActivationTime) {
|
||||
ris = append(ris, &RatingInfo{"", "", "", cd.TimeStart, nil, []string{cd.GetKey(FALLBACK_SUBJECT)}})
|
||||
ris = append(ris, &RatingInfo{
|
||||
MatchedSubject: "",
|
||||
MatchedPrefix: "",
|
||||
MatchedDestID: "",
|
||||
ActivationTime: cd.TimeStart,
|
||||
RateIntervals: nil,
|
||||
FallbackKeys: []string{cd.GetKey(FALLBACK_SUBJECT)}})
|
||||
}
|
||||
if len(prefix) > 0 {
|
||||
ris = append(ris, &RatingInfo{rp.Id, prefix, destinationId, rpa.ActivationTime, rps, rpa.FallbackKeys})
|
||||
ris = append(ris, &RatingInfo{
|
||||
MatchedSubject: rp.Id,
|
||||
RatingPlanID: rpl.Id,
|
||||
MatchedPrefix: prefix,
|
||||
MatchedDestID: destinationId,
|
||||
ActivationTime: rpa.ActivationTime,
|
||||
RateIntervals: rps,
|
||||
FallbackKeys: rpa.FallbackKeys})
|
||||
} else {
|
||||
// add for fallback information
|
||||
ris = append(ris, &RatingInfo{"", "", "", rpa.ActivationTime, nil, rpa.FallbackKeys})
|
||||
ris = append(ris, &RatingInfo{
|
||||
MatchedSubject: "",
|
||||
MatchedPrefix: "",
|
||||
MatchedDestID: "",
|
||||
ActivationTime: rpa.ActivationTime,
|
||||
RateIntervals: nil,
|
||||
FallbackKeys: rpa.FallbackKeys,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
if len(ris) > 0 {
|
||||
cd.addRatingInfos(ris)
|
||||
return
|
||||
|
||||
@@ -31,13 +31,13 @@ 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
|
||||
DurationIndex time.Duration // the call duration so far till TimeEnd
|
||||
Increments Increments
|
||||
MatchedSubject, MatchedPrefix, MatchedDestId string
|
||||
TimeStart, TimeEnd time.Time
|
||||
Cost float64
|
||||
ratingInfo *RatingInfo
|
||||
RateInterval *RateInterval
|
||||
DurationIndex time.Duration // the call duration so far till TimeEnd
|
||||
Increments Increments
|
||||
MatchedSubject, MatchedPrefix, MatchedDestID, RatingPlanID string
|
||||
}
|
||||
|
||||
type Increment struct {
|
||||
@@ -281,7 +281,8 @@ func (ts *TimeSpan) setRatingInfo(rp *RatingInfo) {
|
||||
ts.ratingInfo = rp
|
||||
ts.MatchedSubject = rp.MatchedSubject
|
||||
ts.MatchedPrefix = rp.MatchedPrefix
|
||||
ts.MatchedDestId = rp.MatchedDestId
|
||||
ts.MatchedDestID = rp.MatchedDestID
|
||||
ts.RatingPlanID = rp.RatingPlanID
|
||||
}
|
||||
|
||||
func (ts *TimeSpan) createIncrementsSlice() {
|
||||
|
||||
@@ -64,7 +64,7 @@ func (self *TPCSVImporter) Run() error {
|
||||
continue
|
||||
}
|
||||
if err := fHandler(self, f.Name()); err != nil {
|
||||
Logger.Err(fmt.Sprintf("<TPCSVImporter> Importing file: %s, got error: %s", err.Error()))
|
||||
Logger.Err(fmt.Sprintf("<TPCSVImporter> Importing file: %s, got error: %s", f.Name(), err.Error()))
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user