예제 #1
0
    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
예제 #2
0
 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)
예제 #3
0
 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
예제 #4
0
 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
예제 #5
0
    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
예제 #6
0
 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
예제 #7
0
 def isLinkedToEquippedRoom(self):
     return self._created and VidyoTools.getLinkRoomIp(self.getLinkObject()) != ""
예제 #8
0
 def connectionStatus(self):
     return VidyoOperations.isRoomConnected(self, VidyoTools.getLinkRoomIp(self.getLinkObject()))
예제 #9
0
 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)
예제 #10
0
 def isLinkedToEquippedRoom(self):
     return self._created and VidyoTools.getLinkRoomIp(
         self.getLinkObject()) != ""
예제 #11
0
 def connectionStatus(self):
     return VidyoOperations.isRoomConnected(
         self, VidyoTools.getLinkRoomIp(self.getLinkObject()))
예제 #12
0
 def canBeConnected(self):
     return self._created and VidyoTools.getLinkRoomIp(self.getLinkObject()) != ""