Skip to content
This repository was archived by the owner on Jun 6, 2023. It is now read-only.

Commit 6e75c2f

Browse files
porosnicuadriandanbogos
authored andcommitted
Fixed error when there are not sessionIds in case of ActiveSessions
1 parent 344aec9 commit 6e75c2f

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

agents/astagent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,9 @@ func (sma *AsteriskAgent) V1GetActiveSessionIDs(ignParam string,
349349
return err
350350
}
351351
var sIDs []*sessions.SessionID
352+
if len(slMpIface) == 0 {
353+
return utils.ErrNoActiveSession
354+
}
352355
for _, mpIface := range slMpIface {
353356
sIDs = append(sIDs, &sessions.SessionID{
354357
OriginHost: strings.Split(sma.cgrCfg.AsteriskAgentCfg().AsteriskConns[sma.astConnIdx].Address, ":")[0],

agents/fsagent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ func (fsa *FSsessions) V1GetActiveSessionIDs(_ string,
432432
})
433433
}
434434
}
435+
if len(sIDs) == 0 {
436+
return utils.ErrNoActiveSession
437+
}
435438
*sessionIDs = sIDs
436439
return
437440
}

agents/kamagent.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,9 @@ func (ka *KamailioAgent) V1GetActiveSessionIDs(ignParam string, sessionIDs *[]*s
421421
return errors.New("timeout executing dialog list")
422422
}
423423
}
424+
if len(*sessionIDs) == 0 {
425+
return utils.ErrNoActiveSession
426+
}
424427
tm.Stop()
425428
return
426429
}

sessions/sessions.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,7 @@ func (sS *SessionS) syncSessions() {
13561356
}()
13571357
select {
13581358
case err = <-errChan:
1359-
if err != nil {
1359+
if err != nil && err.Error() != utils.ErrNoActiveSession.Error() {
13601360
utils.Logger.Warning(
13611361
fmt.Sprintf("<%s> error <%s> quering session ids", utils.SessionS, err.Error()))
13621362
}

0 commit comments

Comments
 (0)