def _connect(self, force=False): self._checkStatus() connectionStatus = self.connectionStatus() if isinstance(connectionStatus, VidyoError): return connectionStatus confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject()) if confRoomIp == "": return VidyoError("noValidConferenceRoom", "connect") if connectionStatus.get("isConnected") == True: if connectionStatus.get("roomName") == self.getBookingParamByName( "roomName"): return VidyoError( "alreadyConnected", "connect", _("It seems that the room has been already connected to the room, please refresh the page." )) if not force: # if connect is not forced, give up return VidyoError( "alreadyConnected", "connect", _("The room is already connected to some other endpoint. Please refresh the page." )) else: # otherwise, replace whatever call is going on ExternalOperationsManager.execute( self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service")) retry = 15 connected = True # wait for the current call to be disconnected while retry: connectionStatus = self.connectionStatus() time.sleep(2) retry -= 1 if connectionStatus.get("isConnected") == False: connected = False break if connected: return VidyoError( "couldntStop", "connect", _("It seems like we haven't managed to stop " "the current call. Please refresh the page and try again." )) else: # give it some time before trying to connect time.sleep(5) prefixConnect = getVidyoOptionValue("prefixConnect") result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId, prefixConnect + confRoomIp) if isinstance(result, VidyoError): return result return self
def _checkProtection(self): if self.getAW().getUser() and self.getHostIP( ) == VidyoTools.getLinkRoomIp(self._booking.getLinkObject(), ipAttName='IP'): return elif not hasattr( self._booking, "getOwnerObject" ) or self._booking.getOwnerObject() != self.getAW().getUser(): CollaborationBookingModifBase._checkProtection(self)
def _connect(self): self._checkStatus() if self.canBeConnected(): confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject()) if confRoomIp == "": return VidyoError("noValidConferenceRoom", "connect") prefixConnect = getVidyoOptionValue("prefixConnect") result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId, prefixConnect + confRoomIp) if isinstance(result, VidyoError): return result return self
def _disconnect(self): self._checkStatus() confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject()) if confRoomIp == "": return VidyoError("noValidConferenceRoom", "disconnect") connectionStatus = self.connectionStatus() if isinstance(connectionStatus, VidyoError): return connectionStatus if not connectionStatus.get("isConnected"): return VidyoError("alreadyDisconnected", "disconnect", _("It seems that the room has been already disconnected, please refresh the page")) result = ExternalOperationsManager.execute(self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service")) if isinstance(result, VidyoError): return result return self
def _connect(self, force=False): self._checkStatus() connectionStatus = self.connectionStatus() if isinstance(connectionStatus, VidyoError): return connectionStatus confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject()) if confRoomIp == "": return VidyoError("noValidConferenceRoom", "connect") if connectionStatus.get("isConnected") == True: if connectionStatus.get("roomName") == self.getBookingParamByName("roomName"): return VidyoError("alreadyConnected", "connect", _("It seems that the room has been already connected to the room, please refresh the page.")) if not force: # if connect is not forced, give up return VidyoError("alreadyConnected", "connect", _("The room is already connected to some other endpoint. Please refresh the page.")) else: # otherwise, replace whatever call is going on ExternalOperationsManager.execute( self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service")) retry = 15 connected = True # wait for the current call to be disconnected while retry: connectionStatus = self.connectionStatus() time.sleep(2) retry -= 1 if connectionStatus.get("isConnected") == False: connected = False break if connected: return VidyoError("couldntStop", "connect", _("It seems like we haven't managed to stop " "the current call. Please refresh the page and try again.")) else: # give it some time before trying to connect time.sleep(5) prefixConnect = getVidyoOptionValue("prefixConnect") result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId, prefixConnect + confRoomIp) if isinstance(result, VidyoError): return result return self
def _disconnect(self): self._checkStatus() confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject()) if confRoomIp == "": return VidyoError("noValidConferenceRoom", "disconnect") connectionStatus = self.connectionStatus() if isinstance(connectionStatus, VidyoError): return connectionStatus if not connectionStatus.get("isConnected"): return VidyoError( "alreadyDisconnected", "disconnect", _("It seems that the room has been already disconnected, please refresh the page" )) result = ExternalOperationsManager.execute( self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service")) if isinstance(result, VidyoError): return result return self
def isLinkedToEquippedRoom(self): return self._created and VidyoTools.getLinkRoomIp(self.getLinkObject()) != ""
def connectionStatus(self): return VidyoOperations.isRoomConnected(self, VidyoTools.getLinkRoomIp(self.getLinkObject()))
def _checkProtection(self): if self.getAW().getUser() and self.getHostIP() == VidyoTools.getLinkRoomIp(self._booking.getLinkObject(), ipAttName='IP'): return elif not hasattr(self._booking, "getOwnerObject") or self._booking.getOwnerObject() != self.getAW().getUser(): CollaborationBookingModifBase._checkProtection(self)
def isLinkedToEquippedRoom(self): return self._created and VidyoTools.getLinkRoomIp( self.getLinkObject()) != ""
def connectionStatus(self): return VidyoOperations.isRoomConnected( self, VidyoTools.getLinkRoomIp(self.getLinkObject()))
def canBeConnected(self): return self._created and VidyoTools.getLinkRoomIp(self.getLinkObject()) != ""