Exemple #1
0
 def isRoomConnected(cls, booking, roomIp="", roomPanoramaUser=""):
     try:
         if roomIp != "":
             answer = RavemApi.isLegacyEndpointConnected(roomIp)
         else:
             answer = RavemApi.isVidyoPanoramaConnected(roomPanoramaUser)
         if not answer.ok or "error" in answer.json():
             Logger.get('Vidyo').exception("""Evt:%s, booking:%s,
                                           Ravem API's isConnected operation not successfull: %s""" %
                                           (booking.getConference().getId(), booking.getId(), answer.text))
             return VidyoError("roomCheckFailed", "roomConnected",
                               _("There was a problem obtaining the room status from Vidyo. {0}").format(VidyoTools.getContactSupportText()))
         result = {"roomName": None, "isConnected": False, "service": None}
         answer = answer.json()
         if "result" in answer:
             for service in answer.get("result").get("services"):
                 if service.get("name", "") == "videoconference":
                     result["roomName"] = VidyoTools.recoverVidyoName(service.get("event_name"))
                     result["isConnected"] = service.get("status") == 1
                     result["service"] = VidyoTools.recoverVidyoDescription(service.get("event_type"))
         return result
     except Exception:
         return VidyoError("roomCheckFailed", "roomConnected",
                           _("There was a problem obtaining the room status from Vidyo. {0}").format(
                                 VidyoTools.getContactSupportText()))
Exemple #2
0
    def _attach(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            Returns None if success.
            Returns a VidyoError if there is a problem.
        """
        result = ExternalOperationsManager.execute(self, "attachRoom", VidyoOperations.attachRoom, self)
        if isinstance(result, VidyoError):
            return result

        else:
            self._roomId = str(result.roomID)
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName), updateAvatar = True)
            recoveredDescription = VidyoTools.recoverVidyoDescription(result.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"
            if bool(result.RoomMode.hasPIN):
                self.setPin(str(result.RoomMode.roomPIN))
            else:
                self.setPin("")
            if bool(result.RoomMode.hasModeratorPIN):
                self.setModeratorPin(str(result.RoomMode.moderatorPIN))
            else:
                self.setModeratorPin("")
            self._bookingParams["autoMute"] = self._getAutomute()
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
            VidyoTools.getIndexByVidyoRoom().indexBooking(self)
Exemple #3
0
 def isRoomConnected(cls, booking, roomIp="", roomPanoramaUser=""):
     try:
         if roomIp != "":
             answer = RavemApi.isLegacyEndpointConnected(roomIp)
         else:
             answer = RavemApi.isVidyoPanoramaConnected(roomPanoramaUser)
         if not answer.ok or "error" in answer.json():
             Logger.get('Vidyo').exception("""Evt:%s, booking:%s,
                                           Ravem API's isConnected operation not successfull: %s"""
                                           %
                                           (booking.getConference().getId(),
                                            booking.getId(), answer.text))
             return VidyoError(
                 "roomCheckFailed", "roomConnected",
                 _("There was a problem obtaining the room status from Vidyo. {0}"
                   ).format(VidyoTools.getContactSupportText()))
         result = {"roomName": None, "isConnected": False, "service": None}
         answer = answer.json()
         if "result" in answer:
             for service in answer.get("result").get("services"):
                 if service.get("name", "") == "videoconference":
                     result["roomName"] = VidyoTools.recoverVidyoName(
                         service.get("event_name"))
                     result["isConnected"] = service.get("status") == 1
                     result["service"] = VidyoTools.recoverVidyoDescription(
                         service.get("event_type"))
         return result
     except Exception:
         return VidyoError(
             "roomCheckFailed", "roomConnected",
             _("There was a problem obtaining the room status from Vidyo. {0}"
               ).format(VidyoTools.getContactSupportText()))
Exemple #4
0
    def isRoomConnected(cls, booking, roomIp):
        try:
            answer = RavemApi.isRoomConnected(roomIp)

            if not answer.ok or answer.json.has_key("error"):
                Logger.get('Vidyo').exception(
                    """Evt:%s, booking:%s, Ravem API's isRoomConnected operation not successfull: %s"""
                    % (booking.getConference().getId(), booking.getId(),
                       answer.text))
                return VidyoError(
                    "roomCheckFailed", "roomConnected",
                    _("There was a problem obtaining the room status. ") +
                    VidyoTools.getContactSupportText())
            result = {"roomName": None, "isConnected": False, "service": None}
            answer = answer.json
            if answer.has_key("result"):
                for service in answer.get("result").get("services"):
                    if service.get("name", "") == "videoconference":
                        result["roomName"] = VidyoTools.recoverVidyoName(
                            service.get("eventName"))
                        result["isConnected"] = service.get("status") == 1
                        result["service"] = VidyoTools.recoverVidyoDescription(
                            service.get("eventType"))
            return result
        except Exception:
            return VidyoError(
                "roomCheckFailed", "roomConnected",
                _("There was a problem obtaining the room status. ") +
                VidyoTools.getContactSupportText())
    def _attach(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            Returns None if success.
            Returns a VidyoError if there is a problem.
        """
        result = ExternalOperationsManager.execute(self, "attachRoom",
                                                   VidyoOperations.attachRoom,
                                                   self)
        if isinstance(result, VidyoError):
            return result

        else:
            self._roomId = str(result.roomID)
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName), updateAvatar=True)
            recoveredDescription = VidyoTools.recoverVidyoDescription(
                result.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"
            if bool(result.RoomMode.hasPIN):
                self.setPin(str(result.RoomMode.roomPIN))
            else:
                self.setPin("")
            if bool(result.RoomMode.hasModeratorPIN):
                self.setModeratorPin(str(result.RoomMode.moderatorPIN))
            else:
                self.setModeratorPin("")
            self._bookingParams["autoMute"] = self._getAutomute()
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
            VidyoTools.getIndexByVidyoRoom().indexBooking(self)
Exemple #6
0
    def _checkStatus(self):
        """ Queries the data for the Vidyo Public room associated to this CSBooking
            and updates the locally stored data.
            When API problems are solved, uncomment and test the commented code.
            The User API call of VidyoOperations.queryRoom will not be necessary any more.
        """
        result = VidyoOperations.queryRoom(self, self._roomId)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            return result

        else:
            adminApiResult = result[0]
            userApiResult = result[1]

            recoveredVidyoName = VidyoTools.recoverVidyoName(
                userApiResult.displayName)
            if recoveredVidyoName:
                self._bookingParams["roomName"] = recoveredVidyoName
            else:
                self._warning = "invalidName"
            self._extension = str(adminApiResult.extension)

            if bool(adminApiResult.RoomMode.hasPIN):
                self._pin = str(adminApiResult.RoomMode.roomPIN)
            else:
                self._pin = ""

            if bool(adminApiResult.RoomMode.hasModeratorPIN):
                self._moderatorPin = str(adminApiResult.RoomMode.moderatorPIN)
            else:
                self._moderatorPin = ""

            self._url = str(adminApiResult.RoomMode.roomURL)
            self.setOwnerAccount(str(adminApiResult.ownerName),
                                 updateAvatar=True)

            recoveredDescription = VidyoTools.recoverVidyoDescription(
                adminApiResult.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"

            # what to do if the Vidyo group is not Indico?
            #if str(adminApiResult.groupName) != getVidyoOptionValue("indicoGroup"):
            #    return VidyoError("invalidGroup", "checkStatus")

            self._bookingParams["autoMute"] = self._getAutomute()
            self._updateRelatedBookings()
Exemple #7
0
    def _checkStatus(self):
        """ Queries the data for the Vidyo Public room associated to this CSBooking
            and updates the locally stored data.
        """
        adminApiResult = VidyoOperations.queryRoom(self, self._roomId)

        if isinstance(adminApiResult, VidyoError):
            if adminApiResult.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            return adminApiResult

        else:

            recoveredVidyoName = VidyoTools.recoverVidyoName(adminApiResult.name)
            if recoveredVidyoName:
                self._bookingParams["roomName"] = recoveredVidyoName
            else:
                self._warning = "invalidName"

            self._extension = str(adminApiResult.extension)

            """

            We do not update the PIN because in the new version of Vidyo comes
            encrypted.

            if bool(adminApiResult.RoomMode.hasPIN):
                self._pin = str(adminApiResult.RoomMode.roomPIN)
            else:
                self._pin = ""

            if bool(adminApiResult.RoomMode.hasModeratorPIN):
                self._moderatorPin = str(adminApiResult.RoomMode.moderatorPIN)
            else:
                self._moderatorPin = ""
            """
            self._url = str(adminApiResult.RoomMode.roomURL)
            self.setOwnerAccount(str(adminApiResult.ownerName), updateAvatar = True)

            recoveredDescription = VidyoTools.recoverVidyoDescription(adminApiResult.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"

            # what to do if the Vidyo group is not Indico?
            #if str(adminApiResult.groupName) != getVidyoOptionValue("indicoGroup"):
            #    return VidyoError("invalidGroup", "checkStatus")

            self._bookingParams["autoMute"] = self._getAutomute()
            self._updateRelatedBookings()
Exemple #8
0
    def _checkStatus(self):
        """ Queries the data for the Vidyo Public room associated to this CSBooking
            and updates the locally stored data.
            When API problems are solved, uncomment and test the commented code.
            The User API call of VidyoOperations.queryRoom will not be necessary any more.
        """
        result = VidyoOperations.queryRoom(self, self._roomId)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            return result

        else:
            adminApiResult = result[0]
            userApiResult = result[1]

            recoveredVidyoName = VidyoTools.recoverVidyoName(userApiResult.displayName)
            if recoveredVidyoName:
                self._bookingParams["roomName"] = recoveredVidyoName
            else:
                self._warning = "invalidName"
            self._extension = str(adminApiResult.extension)

            if bool(adminApiResult.RoomMode.hasPIN):
                self._pin = str(adminApiResult.RoomMode.roomPIN)
            else:
                self._pin = ""

            if bool(adminApiResult.RoomMode.hasModeratorPIN):
                self._moderatorPin = str(adminApiResult.RoomMode.moderatorPIN)
            else:
                self._moderatorPin = ""

            self._url = str(adminApiResult.RoomMode.roomURL)
            self.setOwnerAccount(str(adminApiResult.ownerName), updateAvatar = True)

            recoveredDescription = VidyoTools.recoverVidyoDescription(adminApiResult.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"

            # what to do if the Vidyo group is not Indico?
            #if str(adminApiResult.groupName) != getVidyoOptionValue("indicoGroup"):
            #    return VidyoError("invalidGroup", "checkStatus")

            self._bookingParams["autoMute"] = self._getAutomute()
            self._updateRelatedBookings()
Exemple #9
0
    def isRoomConnected(cls, booking, roomIp):
        try:
            answer =  RavemApi.isRoomConnected(roomIp)

            if not answer.ok or answer.json.has_key("error"):
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Ravem API's isRoomConnected operation not successfull: %s""" %
                        (booking.getConference().getId(), booking.getId(), answer.text))
                return VidyoError("roomCheckFailed", "roomConnected", _("There was a problem obtaining the room status. ") + VidyoTools.getContactSupportText())
            result = {"roomName": None, "isConnected": False, "service": None}
            answer =  answer.json
            if answer.has_key("result"):
                for service in answer.get("result").get("services"):
                    if service.get("name","") == "videoconference":
                        result["roomName"] = VidyoTools.recoverVidyoName(service.get("eventName"))
                        result["isConnected"] = service.get("status") == 1
                        result["service"] = VidyoTools.recoverVidyoDescription(service.get("eventType"))
            return result
        except Exception:
            return VidyoError("roomCheckFailed", "roomConnected", _("There was a problem obtaining the room status. ") + VidyoTools.getContactSupportText())