Esempio n. 1
0
def build_service(registrar_dao, provd_client):
    validator = build_validator()
    notifier = RegistrarNotifier(bus)
    line_service = build_line_service(provd_client)
    device_updater = build_device_updater(provd_client)

    registrar_service = RegistrarService(registrar_dao, validator, notifier,
                                         line_service, device_updater,
                                         provd_client)
    return registrar_service
Esempio n. 2
0
def build_service(provd_client):
    return LineSipService(build_line_service(provd_client),
                          build_sip_service(provd_client))
Esempio n. 3
0
def build_service(provd_client, endpoint, endpoint_service):
    validator = build_validator(endpoint)
    line_service = build_line_service(provd_client)
    return LineEndpointService(endpoint, line_service, endpoint_service,
                               validator)
Esempio n. 4
0
    def load(self, dependencies):
        api = dependencies['api']
        config = dependencies['config']
        token_changed_subscribe = dependencies['token_changed_subscribe']
        set_auth_client_config(config['auth'])

        provd_client = ProvdClient(**config['provd'])
        token_changed_subscribe(provd_client.set_token)

        user_service = build_user_service(provd_client)
        wazo_user_service = build_wazo_user_service()
        user_voicemail_service = build_uv_service()
        voicemail_service = build_voicemail_service()
        line_service = build_line_service(provd_client)
        sip_service = build_sip_service(provd_client)
        sccp_service = build_sccp_service()
        line_sip_service = build_le_service(provd_client, 'sip', sip_service)
        line_sccp_service = build_le_service(provd_client, 'sccp',
                                             sccp_service)
        extension_service = build_extension_service(provd_client)
        user_line_service = build_ul_service()
        line_extension_service = build_line_extension_service()
        call_permission_service = build_call_permission_service()
        user_call_permission_service = build_user_call_permission_service()
        incall_service = build_incall_service()
        incall_extension_service = build_incall_extension_service()
        context_service = build_context_service()

        creators = {
            'user': UserCreator(user_service),
            'wazo_user': WazoUserCreator(wazo_user_service),
            'line': LineCreator(line_service),
            'voicemail': VoicemailCreator(voicemail_service),
            'sip': SipCreator(sip_service),
            'sccp': SccpCreator(sccp_service),
            'extension': ExtensionCreator(extension_service),
            'extension_incall': ExtensionCreator(extension_service),
            'incall': IncallCreator(incall_service),
            'call_permissions': CallPermissionCreator(call_permission_service),
            'context': ContextCreator(context_service),
        }

        entry_creator = EntryCreator(creators)

        associators = OrderedDict([
            ('wazo_user', WazoUserAssociator(wazo_user_service)),
            ('voicemail', VoicemailAssociator(user_voicemail_service)),
            ('sip', SipAssociator(line_sip_service)),
            ('sccp', SccpAssociator(line_sccp_service)),
            ('line', LineAssociator(user_line_service)),
            ('extension', ExtensionAssociator(line_extension_service)),
            ('incall', IncallAssociator(incall_extension_service)),
            (
                'call_permissions',
                CallPermissionAssociator(user_call_permission_service,
                                         call_permission_service),
            ),
        ])

        entry_associator = EntryAssociator(associators)

        entry_finder = EntryFinder(
            user_dao,
            voicemail_dao,
            user_voicemail_dao,
            line_dao,
            user_line_dao,
            line_extension_dao,
            sip_dao,
            sccp_dao,
            extension_dao,
            incall_dao,
            call_permission_dao,
            user_call_permission_dao,
        )

        entry_updater = EntryUpdater(creators, associators, entry_finder)

        import_service = ImportService(entry_creator, entry_associator,
                                       entry_updater)
        api.add_resource(UserImportResource,
                         '/users/import',
                         resource_class_args=(import_service, ))

        export_service = ExportService(user_export_dao, auth_client)
        api.add_resource(UserExportResource,
                         '/users/export',
                         resource_class_args=(export_service, ))
Esempio n. 5
0
def build_service_sip(provd_client):
    validator = build_validator_sip()
    line_service = build_line_service(provd_client)
    notifier = build_notifier_sip()
    return LineEndpointSIPService(line_dao_module, line_service, validator, notifier)