mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Fix asActiveSession
This commit is contained in:
committed by
Dan Christian Bogos
parent
fe662a157c
commit
65e3fbc021
@@ -189,7 +189,6 @@ func TestRAitAcctStart(t *testing.T) {
|
||||
if len(reply.AVPs) != 0 { // we don't expect AVPs to be populated
|
||||
t.Errorf("Received AVPs: %+v", reply.AVPs)
|
||||
}
|
||||
time.Sleep(500 * time.Millisecond) // Wait so session is made
|
||||
// Make sure the sessin is managed by SMG
|
||||
var aSessions []*sessions.ActiveSession
|
||||
if err := raRPC.Call(utils.SessionSv1GetActiveSessions,
|
||||
|
||||
@@ -95,7 +95,8 @@ func NewSMGeneric(cgrCfg *config.CGRConfig, rals, resS, thdS,
|
||||
if chargerS != nil && reflect.ValueOf(chargerS).IsNil() {
|
||||
chargerS = nil
|
||||
}
|
||||
return &SMGeneric{cgrCfg: cgrCfg,
|
||||
return &SMGeneric{
|
||||
cgrCfg: cgrCfg,
|
||||
chargerS: chargerS,
|
||||
rals: rals,
|
||||
resS: resS,
|
||||
@@ -427,6 +428,9 @@ func (smg *SMGeneric) getSessionIDsMatchingIndexes(fltrs map[string]string,
|
||||
runID := fltrs[utils.RunID]
|
||||
checkNr := 0
|
||||
for fltrName, fltrVal := range fltrs {
|
||||
if fltrName == utils.RunID {
|
||||
continue
|
||||
}
|
||||
checkNr += 1
|
||||
if _, hasFldName := ssIndx[fltrName]; !hasFldName {
|
||||
continue
|
||||
@@ -447,11 +451,11 @@ func (smg *SMGeneric) getSessionIDsMatchingIndexes(fltrs map[string]string,
|
||||
continue
|
||||
}
|
||||
// Higher run, takes out non matching indexes
|
||||
for cgrID := range ssIndx[fltrName][fltrVal] {
|
||||
if _, hasCGRID := matchingSessions[cgrID]; !hasCGRID {
|
||||
delete(matchingSessions, cgrID)
|
||||
}
|
||||
}
|
||||
// for cgrID := range ssIndx[fltrName][fltrVal] /*[runID]*/ {
|
||||
// if _, hasCGRID := matchingSessions[cgrID]; !hasCGRID {
|
||||
// delete(matchingSessions, cgrID)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
return matchingSessions.Clone(), matchedIndexes
|
||||
}
|
||||
|
||||
@@ -673,6 +673,7 @@ func TestSMGVoiceSessionTTL(t *testing.T) {
|
||||
} else if acnt.BalanceMap[utils.MONETARY].GetTotalValue() != eAcntVal {
|
||||
t.Errorf("Expected: %f, received: %f", eAcntVal, acnt.BalanceMap[utils.MONETARY].GetTotalValue())
|
||||
}
|
||||
time.Sleep(time.Duration(100 * time.Millisecond))
|
||||
var cdrs []*engine.ExternalCDR
|
||||
req := utils.RPCCDRsFilter{RunIDs: []string{utils.META_DEFAULT}, DestinationPrefixes: []string{"1008"}}
|
||||
if err := smgRPC.Call("ApierV2.GetCdrs", req, &cdrs); err != nil {
|
||||
@@ -966,7 +967,7 @@ func TestSMGVoiceRelocateWithOriginIDPrefix(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Received reply: %s", reply)
|
||||
}
|
||||
time.Sleep(time.Duration(20) * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
var cdrs []*engine.ExternalCDR
|
||||
req := utils.RPCCDRsFilter{RunIDs: []string{utils.META_DEFAULT},
|
||||
DestinationPrefixes: []string{smgEv.GetStringIgnoreErrors(utils.Destination)}}
|
||||
|
||||
@@ -180,7 +180,7 @@ func TestSMGBiRPCSessionAutomaticDisconnects(t *testing.T) {
|
||||
} else if reply != utils.OK {
|
||||
t.Errorf("Received reply: %s", reply)
|
||||
}
|
||||
time.Sleep(time.Duration(20) * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
var cdrs []*engine.ExternalCDR
|
||||
req := utils.RPCCDRsFilter{RunIDs: []string{utils.META_DEFAULT},
|
||||
DestinationPrefixes: []string{smgEv.GetStringIgnoreErrors(utils.Destination)}}
|
||||
|
||||
Reference in New Issue
Block a user