예제 #1
0
 def connectionStatus(self):
     return VidyoOperations.isRoomConnected(
         self,
         VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                         attName="h323-ip"),
         VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                         attName="vidyopanorama-id"))
예제 #2
0
    def _connect(self, force=False):
        self._checkStatus()

        connectionStatus = self.connectionStatus()
        if isinstance(connectionStatus, VidyoError):
            return connectionStatus

        confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="H323 IP")
        confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="VidyoPanorama ID")
        if confRoomIp == "" and confRoomPanoramaUser == "":
            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, connectionStatus, confRoomIp, confRoomPanoramaUser)

                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)

        query = (getVidyoOptionValue("prefixConnect") + confRoomIp) if confRoomIp else confRoomPanoramaUser
        result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId,
                                                   query)
        if isinstance(result, VidyoError):
            return result
        return self
예제 #3
0
 def _disconnect(self):
     self._checkStatus()
     confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="H323 IP")
     confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="VidyoPanorama ID")
     if confRoomIp == "" and confRoomPanoramaUser == "":
         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,
                                                connectionStatus, confRoomIp, confRoomPanoramaUser)
     if isinstance(result, VidyoError):
         return result
     return self
예제 #4
0
 def _checkProtection(self):
     if self.getAW().getUser(
     ) and request.remote_addr == VidyoTools.getLinkRoomAttribute(
             self._booking.getLinkObject(), attName='ip'):
         return
     elif not hasattr(
             self._booking, "getOwnerObject"
     ) or self._booking.getOwnerObject() != self.getAW().getUser():
         CollaborationBookingModifBase._checkProtection(self)
예제 #5
0
 def _disconnect(self):
     self._checkStatus()
     confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                  attName="h323-ip")
     confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(
         self.getLinkObject(), attName="vidyopanorama-id")
     if confRoomIp == "" and confRoomPanoramaUser == "":
         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,
         connectionStatus, confRoomIp, confRoomPanoramaUser)
     if isinstance(result, VidyoError):
         return result
     return self
예제 #6
0
 def connectionStatus(self):
     return VidyoOperations.isRoomConnected(self, VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                                                  attName="H323 IP"),
                                            VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                                            attName="VidyoPanorama ID"))
예제 #7
0
 def isLinkedToEquippedRoom(self):
     return self._created and (VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="H323 IP") != "" or
                               VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                               attName="VidyoPanorama ID") != "")
예제 #8
0
 def connectionStatus(self):
     return VidyoOperations.isRoomConnected(self, VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                                                  attName="h323-ip"),
                                            VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                                            attName="vidyopanorama-id"))
예제 #9
0
 def isLinkedToEquippedRoom(self):
     return self._created and (VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="h323-ip") != "" or
                               VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                               attName="vidyopanorama-id") != "")
예제 #10
0
 def _checkProtection(self):
     if self.getAW().getUser() and request.remote_addr == VidyoTools.getLinkRoomAttribute(self._booking.getLinkObject(),
                                                                                          attName='IP'):
         return
     elif not hasattr(self._booking, "getOwnerObject") or self._booking.getOwnerObject() != self.getAW().getUser():
         CollaborationBookingModifBase._checkProtection(self)
예제 #11
0
    def _connect(self, force=False):
        self._checkStatus()

        connectionStatus = self.connectionStatus()
        if isinstance(connectionStatus, VidyoError):
            return connectionStatus

        confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(),
                                                     attName="h323-ip")
        confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(
            self.getLinkObject(), attName="vidyopanorama-id")
        if confRoomIp == "" and confRoomPanoramaUser == "":
            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, connectionStatus, confRoomIp, confRoomPanoramaUser)

                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)

        query = (getVidyoOptionValue("prefixConnect") +
                 confRoomIp) if confRoomIp else confRoomPanoramaUser
        result = ExternalOperationsManager.execute(self, "connectRoom",
                                                   VidyoOperations.connectRoom,
                                                   self, self._roomId, query)
        if isinstance(result, VidyoError):
            return result
        return self
예제 #12
0
 def isLinkedToEquippedRoom(self):
     return self._created and (VidyoTools.getLinkRoomAttribute(
         self.getLinkObject(),
         attName="h323-ip") != "" or VidyoTools.getLinkRoomAttribute(
             self.getLinkObject(), attName="vidyopanorama-id") != "")