fallback on *any destination

This commit is contained in:
Radu Ioan Fericean
2014-05-28 13:53:49 +03:00
parent 7b2a452c4f
commit b62d7ba52d
2 changed files with 10 additions and 3 deletions

View File

@@ -141,6 +141,13 @@ func (rp *RatingProfile) GetRatingPlansForPrefix(cd *CallDescriptor) (err error)
break
}
}
if rps == nil { // fallback on *any destination
if _, ok := rpl.DestinationRates[utils.ANY]; ok {
rps = rpl.RateIntervalList(utils.ANY)
prefix = utils.ANY
destinationId = utils.ANY
}
}
}
// 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) {

View File

@@ -27,14 +27,14 @@ import (
"github.com/cgrates/cgrates/utils"
)
func TestSetStorageSmsChrg1(t *testing.T) {
func TestSMSSetStorageSmsChrg1(t *testing.T) {
ratingDb, _ = engine.NewMapStorageJson()
engine.SetRatingStorage(ratingDb)
acntDb, _ = engine.NewMapStorageJson()
engine.SetAccountingStorage(acntDb)
}
func TestLoadCsvTpSmsChrg1(t *testing.T) {
func TestSMSLoadCsvTpSmsChrg1(t *testing.T) {
timings := `ALWAYS,*any,*any,*any,*any,00:00:00`
rates := `RT_SMS_5c,0,0.005,1,1,0`
destinationRates := `DR_SMS_1,*any,RT_SMS_5c,*up,4`
@@ -68,7 +68,7 @@ func TestLoadCsvTpSmsChrg1(t *testing.T) {
}
}
func TestGetDataCostSmsChrg1(t *testing.T) {
func TestSMSGetDataCostSmsChrg1(t *testing.T) {
usageDur := time.Second
timeStart := time.Date(2014, 3, 4, 0, 0, 0, 0, time.Local)
cd := &engine.CallDescriptor{