diff --git a/room.go b/room.go index 7149f46..3458b2f 100644 --- a/room.go +++ b/room.go @@ -957,14 +957,8 @@ func (r *Room) NotifySessionChanged(session Session, flags SessionChangeFlag) { if flags&SessionChangeInCall != 0 { joinLeave := 0 - if clientSession, ok := session.(*ClientSession); ok { - if clientSession.GetInCall()&FlagInCall != 0 { - joinLeave = 1 - } else { - joinLeave = 2 - } - } else if virtual, ok := session.(*VirtualSession); ok { - if virtual.GetInCall()&FlagInCall != 0 { + if session, ok := session.(SessionWithInCall); ok { + if session.GetInCall()&FlagInCall != 0 { joinLeave = 1 } else { joinLeave = 2 diff --git a/session.go b/session.go index 718b8ac..a27efea 100644 --- a/session.go +++ b/session.go @@ -76,6 +76,10 @@ type Session interface { SendMessage(message *ServerMessage) bool } +type SessionWithInCall interface { + GetInCall() int +} + func parseUserData(data json.RawMessage) func() (api.StringMap, error) { return sync.OnceValues(func() (api.StringMap, error) { if len(data) == 0 {