예제 #1
0
 def __init__(self,
              sip_user_id=None,
              is_active=None,
              processing=None,
              voice_message_delivery_email_address=None,
              use_phone_message_waiting_indicator=None,
              send_voice_message_notify_email=None,
              voice_message_notify_email_address=None,
              send_carbon_copy_voice_message=None,
              voice_message_carbon_copy_email_address=None,
              transfer_on_zero_to_phone_number=None,
              transfer_phone_number=None,
              always_redirect_to_voice_mail=None,
              busy_redirect_to_voice_mail=None,
              no_answer_redirect_to_voice_mail=None,
              out_of_primary_zone_redirect_to_voice_mail=None,
              **kwargs):
     self.sip_user_id = sip_user_id
     self.is_active = is_active
     self.processing = processing
     self.voice_message_delivery_email_address = voice_message_delivery_email_address
     self.use_phone_message_waiting_indicator = use_phone_message_waiting_indicator
     self.send_voice_message_notify_email = send_voice_message_notify_email
     self.voice_message_notify_email_address = voice_message_notify_email_address
     self.send_carbon_copy_voice_message = send_carbon_copy_voice_message
     self.voice_message_carbon_copy_email_address = voice_message_carbon_copy_email_address
     self.transfer_on_zero_to_phone_number = transfer_on_zero_to_phone_number
     self.transfer_phone_number = transfer_phone_number
     self.always_redirect_to_voice_mail = always_redirect_to_voice_mail
     self.busy_redirect_to_voice_mail = busy_redirect_to_voice_mail
     self.no_answer_redirect_to_voice_mail = no_answer_redirect_to_voice_mail
     self.out_of_primary_zone_redirect_to_voice_mail = out_of_primary_zone_redirect_to_voice_mail
     BroadsoftRequest.__init__(self, **kwargs)
예제 #2
0
    def __init__(self,
                 device_name=None,
                 description=None,
                 protocol='SIP 2.0',
                 transport_protocol='Unspecified',
                 mac_address=None,
                 ip_address=None,
                 port=None,
                 sip_user_name=None,
                 sip_password=None,
                 **kwargs):
        self.description = description
        self.device_name = device_name
        self.ip_address = ip_address
        self.mac_address = mac_address
        self.port = port
        self.protocol = protocol
        self.sip_user_name = sip_user_name
        self.sip_password = sip_password
        self.transport_protocol = transport_protocol

        # these I don't expect to ever feed, so not in __init__args, but available to be modified just in case
        self.configuration_file = None
        self.configuration_mode = 'Default'
        self.mobility_manager_default_originating_service_key = None
        self.mobility_manager_default_terminating_service_key = None
        self.mobility_manager_provisioning_URL = None
        self.mobility_manager_provisioning_user_name = None
        self.mobility_manager_provisioning_password = None
        self.outbound_proxy_server_net_address = None
        self.physical_location = None
        self.serial_number = None
        self.stun_server_net_address = None

        BroadsoftRequest.__init__(self, **kwargs)
예제 #3
0
    def find_device_by_mac_and_did(mac_address, did, **kwargs):
        from broadsoft.requestobjects.GroupAccessDeviceGetRequest import GroupAccessDeviceGetRequest
        from broadsoft.requestobjects.UserGetRequest import UserGetRequest
        from broadsoft.requestobjects.lib.BroadsoftRequest import BroadsoftRequest

        devices = GroupAccessDeviceGetListRequest.find_device_by_mac(
            mac_address=mac_address, **kwargs)
        for d in devices:
            # first, fetch the device based on the name.
            fetched_device_xml = GroupAccessDeviceGetRequest.get_device(
                name=d['Device Name'], **kwargs)

            # this will give us a user. fetch that user.
            sip_user_id = fetched_device_xml.findall('.//userName')[0].text
            user = UserGetRequest.get_user(sip_user_id=sip_user_id, **kwargs)

            # does the user match the passed DID? If so, the MAC/DID pair is assigned.
            results = user.findall('./command/phoneNumber')
            if len(results) > 1:
                raise RuntimeError(
                    "UserGetRequest.get_user() returned too many results")
            user_did = user.findall('./command/phoneNumber')[0].text
            user_did = BroadsoftRequest.convert_phone_number(number=user_did)
            did = BroadsoftRequest.convert_phone_number(number=did)

            if did == user_did:
                return d

        return None
예제 #4
0
    def __init__(self, sip_user_id=None, last_name=None, first_name=None, clid_first_name=None,
                 clid_last_name=None, name_dialing_name=None, did=None, extension=None, clid_did=None,
                 old_password=None, new_password=None, email_address=None, device_name=None,
                 line_port=None, include_endpoint=False,
                 **kwargs):
        self.clid_did = clid_did
        self.clid_first_name = clid_first_name
        self.clid_last_name = clid_last_name
        self.device_name = device_name
        self.did = did
        self.email_address = email_address
        self.extension = extension
        self.first_name = first_name
        self.last_name = last_name
        self.line_port = line_port
        self.name_dialing_name = name_dialing_name
        self.new_password = new_password
        self.old_password = old_password
        self.sip_user_id = sip_user_id
        self.include_endpoint = include_endpoint
        self.derive_extension()

        self.drone_actions = {}

        BroadsoftRequest.__init__(self, **kwargs)
 def __init__(self,
              sip_user_id=None,
              mail_server_selection=None,
              group_mail_server_email_address=None,
              group_mail_server_user_id=None,
              group_mail_server_password=None,
              use_group_default_mail_server_full_mailbox_limit=True,
              group_mail_server_full_mailbox_limit=None,
              personal_mail_server_net_address=None,
              personal_mail_server_protocol=None,
              personal_mail_server_real_delete_for_imap=None,
              personal_mail_server_email_address=None,
              personal_mail_server_user_id=None,
              personal_mail_server_password=None,
              **kwargs):
     self.sip_user_id = sip_user_id
     # options are 'Group Mail Server' and 'Personal Mail Server'
     self.mail_server_selection = mail_server_selection
     self.group_mail_server_email_address = group_mail_server_email_address
     self.group_mail_server_user_id = group_mail_server_user_id
     self.group_mail_server_password = group_mail_server_password
     self.use_group_default_mail_server_full_mailbox_limit = use_group_default_mail_server_full_mailbox_limit
     self.group_mail_server_full_mailbox_limit = group_mail_server_full_mailbox_limit
     self.personal_mail_server_net_address = personal_mail_server_net_address
     self.personal_mail_server_protocol = personal_mail_server_protocol
     self.personal_mail_server_real_delete_for_imap = personal_mail_server_real_delete_for_imap
     self.personal_mail_server_email_address = personal_mail_server_email_address
     self.personal_mail_server_user_id = personal_mail_server_user_id
     self.personal_mail_server_password = personal_mail_server_password
     BroadsoftRequest.__init__(self, **kwargs)
예제 #6
0
    def prep_attributes(self):
        # per the Broadsoft API, first_name and last_name can't be blank for certain objects
        if not self.first_name:
            self.first_name = '(None)'

        if not self.last_name:
            self.last_name = '(None)'

        BroadsoftRequest.prep_attributes(self=self)
예제 #7
0
 def __init__(self, group_id=None, group_name=None, **kwargs):
     self.calling_line_id_name = None
     self.contact_email = None
     self.contact_name = None
     self.contact_number = None
     self.group_id = group_id
     self.group_name = group_name
     self.user_limit = 100000
     BroadsoftRequest.__init__(self, **kwargs)
예제 #8
0
    def __init__(self,
                 sip_user_id=None,
                 did=None,
                 new_password=None,
                 **kwargs):
        self.did = did
        self.new_password = new_password
        self.sip_user_id = sip_user_id

        BroadsoftRequest.__init__(self, **kwargs)
    def __init__(self,
                 sip_user_id=None,
                 device_name='Generic',
                 line_port=None,
                 **kwargs):
        self.device_name = device_name
        self.line_port = line_port
        self.sip_user_id = sip_user_id

        # don't expect to ever overwrite these, so not in init
        self.is_active = True
        self.allow_origination = True
        self.allow_termination = True

        BroadsoftRequest.__init__(self, **kwargs)
예제 #10
0
    def __init__(self,
                 sip_user_id=None,
                 services=None,
                 service_pack=None,
                 **kwargs):
        self.service_pack = service_pack
        self.services = []
        if services:
            if type(services) is str():
                services = [services]
            for s in services:
                self.services.append(s)
        self.sip_user_id = sip_user_id

        BroadsoftRequest.__init__(self, **kwargs)
예제 #11
0
 def __init__(self,
              kname=None,
              sip_user_id=None,
              last_name=None,
              first_name=None,
              did=None,
              sip_password=None,
              email=None,
              **kwargs):
     self.did = did
     self.first_name = first_name
     self.kname = kname
     self.last_name = last_name
     self.sip_password = sip_password
     self.sip_user_id = sip_user_id
     self.email = email
     self.derive_email()
     BroadsoftRequest.__init__(self, **kwargs)
 def __init__(self,
              sip_user_id=None,
              alert_all_appearances_for_click_to_dial_calls=True,
              alert_all_appearances_for_group_paging_calls=False,
              allow_sca_call_retrieve=True,
              multiple_call_arrangement_is_active=True,
              allow_bridging_between_locations=False,
              bridge_warning_tone='None',
              enable_call_park_notification=False,
              **kwargs):
     self.sip_user_id = sip_user_id
     self.alert_all_appearances_for_click_to_dial_calls = alert_all_appearances_for_click_to_dial_calls
     self.alert_all_appearances_for_group_paging_calls = alert_all_appearances_for_group_paging_calls
     self.allow_sca_call_retrieve = allow_sca_call_retrieve
     self.multiple_call_arrangement_is_active = multiple_call_arrangement_is_active
     self.allow_bridging_between_locations = allow_bridging_between_locations
     self.bridge_warning_tone = bridge_warning_tone
     self.enable_call_park_notification = enable_call_park_notification
     BroadsoftRequest.__init__(self, **kwargs)
예제 #13
0
    def find_device_by_mac(mac_address, return_raw=False, **kwargs):
        g = GroupAccessDeviceGetListRequest(mac_address=mac_address, **kwargs)
        xml = g.post()

        if return_raw:
            return xml

        # convert results to dict
        if type(xml) is str:
            xml = ET.fromstring(xml)
        table = xml.findall('./command/accessDeviceTable')[0]
        return BroadsoftRequest.convert_results_table(xml=table)
예제 #14
0
 def __init__(self,
              sip_user_id=None,
              is_active=None,
              busy_redirect_to_voice_mail=None,
              no_answer_redirect_to_voice_mail=None,
              server_selection=None,
              user_server=None,
              mailbox_id_type=None,
              no_answer_number_of_rings=None,
              always_redirect_to_voice_mail=None,
              out_of_primary_zone_redirect_to_voice_mail=None,
              **kwargs):
     self.always_redirect_to_voice_mail = always_redirect_to_voice_mail
     self.busy_redirect_to_voice_mail = busy_redirect_to_voice_mail
     self.is_active = is_active
     self.mailbox_id_type = mailbox_id_type
     self.no_answer_number_of_rings = no_answer_number_of_rings
     self.no_answer_redirect_to_voice_mail = no_answer_redirect_to_voice_mail
     self.out_of_primary_zone_redirect_to_voice_mail = out_of_primary_zone_redirect_to_voice_mail
     self.server_selection = server_selection
     self.sip_user_id = sip_user_id
     self.user_server = user_server
     BroadsoftRequest.__init__(self, **kwargs)
예제 #15
0
    def build_command_xml(self):
        if self.user_server is not None:
            self.user_server = BroadsoftRequest.convert_phone_number(
                number=self.user_server)
        self.prep_for_xml()
        self.validate()

        cmd = self.build_command_shell()

        uid = ET.SubElement(cmd, 'userId')
        uid.text = self.sip_user_id

        if self.is_active is not None:
            s = ET.SubElement(cmd, 'isActive')
            s.text = self.is_active

        if self.busy_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'busyRedirectToVoiceMail')
            s.text = self.busy_redirect_to_voice_mail

        if self.no_answer_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'noAnswerRedirectToVoiceMail')
            s.text = self.no_answer_redirect_to_voice_mail

        if self.server_selection is not None:
            s = ET.SubElement(cmd, 'serverSelection')
            s.text = self.server_selection

        if self.user_server is not None:
            s = ET.SubElement(cmd, 'userServer')
            s.text = str(self.user_server)

        if self.mailbox_id_type is not None:
            s = ET.SubElement(cmd, 'mailboxIdType')
            s.text = self.mailbox_id_type

        if self.no_answer_number_of_rings is not None:
            s = ET.SubElement(cmd, 'noAnswerNumberOfRings')
            s.text = str(self.no_answer_number_of_rings)

        if self.always_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'alwaysRedirectToVoiceMail')
            s.text = self.always_redirect_to_voice_mail

        if self.out_of_primary_zone_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'outOfPrimaryZoneRedirectToVoiceMail')
            s.text = self.out_of_primary_zone_redirect_to_voice_mail

        return cmd
예제 #16
0
    def build_command_xml(self):
        self.prep_for_xml()
        self.validate()

        cmd = self.build_command_shell()

        if self.broadsoftinstance.service_provider:
            sp = ET.SubElement(cmd, 'serviceProviderId')
            sp.text = str(self.broadsoftinstance.service_provider)

        if self.group_id:
            gid = ET.SubElement(cmd, 'groupId')
            gid.text = self.group_id

        dd = ET.SubElement(cmd, 'defaultDomain')
        dd.text = self.broadsoftinstance.default_domain

        if self.user_limit is not None:
            ul = ET.SubElement(cmd, 'userLimit')
            ul.text = str(int(self.user_limit))

        if self.group_name:
            gid = ET.SubElement(cmd, 'groupName')
            gid.text = self.group_name

        clid = ET.SubElement(cmd, 'callingLineIdName')
        clid.text = self.derive_calling_line_id_name()

        tz = ET.SubElement(cmd, 'timeZone')
        tz.text = self.timezone

        if self.derive_build_contact():
            c = ET.SubElement(cmd, 'contact')

            if self.contact_name:
                cname = ET.SubElement(c, 'contactName')
                cname.text = self.contact_name

            if self.contact_number:
                cnumber = ET.SubElement(c, 'contactNumber')
                cnumber.text = BroadsoftRequest.convert_phone_number(
                    number=self.contact_number, dashes=True)

            if self.contact_email:
                ce = ET.SubElement(c, 'contactEmail')
                ce.text = self.contact_email

        return cmd
예제 #17
0
    def __init__(self, sip_user_id=None, **kwargs):
        self.sip_user_id = sip_user_id

        BroadsoftRequest.__init__(self, **kwargs)
예제 #18
0
    def __init__(self, sip_user_id=None, devices=None, **kwargs):
        self.sip_user_id = sip_user_id
        self.devices = devices

        BroadsoftRequest.__init__(self, **kwargs)
예제 #19
0
 def derive_extension(self, digits=5):
     if not self.extension and self.did:
         self.did = BroadsoftRequest.convert_phone_number(number=self.did)
         self.extension = str(self.did)[-digits:]
예제 #20
0
 def prep_attributes(self):
     BroadsoftRequest.prep_attributes(self)
     self.set_drones()
예제 #21
0
 def list_devices(**kwargs):
     from broadsoft.requestobjects.lib.BroadsoftRequest import BroadsoftRequest
     g = GroupAccessDeviceGetListRequest(**kwargs)
     xml = g.post()
     return BroadsoftRequest.convert_results_table(xml=xml)
예제 #22
0
    def __init__(self, name=None, **kwargs):
        self.name = name

        BroadsoftRequest.__init__(self, **kwargs)
    def __init__(self, device_name=None, **kwargs):
        self.device_name = device_name

        BroadsoftRequest.__init__(self, **kwargs)
예제 #24
0
    def build_command_xml(self):
        if self.transfer_phone_number is not None:
            self.transfer_phone_number = BroadsoftRequest.convert_phone_number(
                number=self.transfer_phone_number)
        self.prep_for_xml()
        self.validate()

        cmd = self.build_command_shell()

        uid = ET.SubElement(cmd, 'userId')
        uid.text = self.sip_user_id

        if self.is_active is not None:
            s = ET.SubElement(cmd, 'isActive')
            s.text = self.is_active

        if self.processing is not None:
            s = ET.SubElement(cmd, 'processing')
            s.text = self.processing

        if self.voice_message_delivery_email_address is not None:
            s = ET.SubElement(cmd, 'voiceMessageDeliveryEmailAddress')
            s.text = self.voice_message_delivery_email_address

        if self.use_phone_message_waiting_indicator is not None:
            s = ET.SubElement(cmd, 'usePhoneMessageWaitingIndicator')
            s.text = self.use_phone_message_waiting_indicator

        if self.send_voice_message_notify_email is not None:
            s = ET.SubElement(cmd, 'sendVoiceMessageNotifyEmail')
            s.text = self.send_voice_message_notify_email

        if self.voice_message_notify_email_address is not None:
            s = ET.SubElement(cmd, 'voiceMessageNotifyEmailAddress')
            s.text = self.voice_message_notify_email_address

        if self.send_carbon_copy_voice_message is not None:
            s = ET.SubElement(cmd, 'sendCarbonCopyVoiceMessage')
            s.text = self.send_carbon_copy_voice_message

        if self.voice_message_carbon_copy_email_address is not None:
            s = ET.SubElement(cmd, 'voiceMessageCarbonCopyEmailAddress')
            s.text = self.voice_message_carbon_copy_email_address

        if self.transfer_on_zero_to_phone_number is not None:
            s = ET.SubElement(cmd, 'transferOnZeroToPhoneNumber')
            s.text = self.transfer_on_zero_to_phone_number

        if self.transfer_phone_number is not None:
            s = ET.SubElement(cmd, 'transferPhoneNumber')
            s.text = self.transfer_phone_number

        if self.always_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'alwaysRedirectToVoiceMail')
            s.text = self.always_redirect_to_voice_mail

        if self.busy_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'busyRedirectToVoiceMail')
            s.text = self.busy_redirect_to_voice_mail

        if self.no_answer_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'noAnswerRedirectToVoiceMail')
            s.text = self.no_answer_redirect_to_voice_mail

        if self.out_of_primary_zone_redirect_to_voice_mail is not None:
            s = ET.SubElement(cmd, 'outOfPrimaryZoneRedirectToVoiceMail')
            s.text = self.out_of_primary_zone_redirect_to_voice_mail

        return cmd
예제 #25
0
 def list_users(**kwargs):
     g = UserGetListInGroupRequest(**kwargs)
     xml = g.post()
     return BroadsoftRequest.convert_results_table(xml=xml)
예제 #26
0
 def get_devices(sip_user_id=None, **kwargs):
     u = UserSharedCallAppearanceGetRequest(sip_user_id=sip_user_id,
                                            **kwargs)
     xml = u.post()
     return BroadsoftRequest.convert_results_table(xml=xml)
예제 #27
0
 def __init__(self, response_size_limit=100000, **kwargs):
     self.response_size_limit = response_size_limit
     BroadsoftRequest.__init__(self, **kwargs)