Example #1
0
    def get(self):
        user_uuid = get_token_user_uuid_from_request()
        transfers = self._transfers_service.list_from_user(user_uuid)

        return {
            'items': [transfer.to_dict() for transfer in transfers]
        }, 200
Example #2
0
    def get(self, relocate_uuid):
        user_uuid = get_token_user_uuid_from_request()
        relocate = self._relocates_service.get_from_user(
            relocate_uuid, user_uuid)

        result = relocate_schema.dump(relocate)
        return result, 200
Example #3
0
 def delete(self, adhoc_conference_id, call_id):
     user_uuid = get_token_user_uuid_from_request()
     self._adhoc_conference_service.remove_participant_from_user(
         adhoc_conference_id,
         call_id,
         user_uuid,
     )
     return '', 204
Example #4
0
 def put(self, message_id):
     user_uuid = get_token_user_uuid_from_request()
     message_id = _validate_message_id(message_id)
     data = voicemail_message_update_schema.load(
         request.get_json(force=True))
     self._voicemails_service.move_user_message(user_uuid, message_id,
                                                data['folder_id'])
     return '', 204
Example #5
0
    def post(self):
        request_body = user_call_request_schema.load(request.get_json(force=True))

        user_uuid = get_token_user_uuid_from_request()

        call = self.calls_service.originate_user(request_body, user_uuid)

        return call_schema.dump(call), 201
Example #6
0
 def post(self, greeting):
     user_uuid = get_token_user_uuid_from_request()
     greeting = _validate_greeting(greeting)
     params = request.get_json(force=True)
     greeting_form = voicemail_greeting_copy_schema.load(params)
     dest_greeting = greeting_form['dest_greeting']
     self._service.copy_user_greeting(user_uuid, greeting, dest_greeting)
     return '', 204
Example #7
0
 def post(self):
     request_body = user_transfer_request_schema.load(
         request.get_json(force=True)).data
     user_uuid = get_token_user_uuid_from_request(self._auth_client)
     transfer = self._transfers_service.create_from_user(
         request_body['initiator_call'], request_body['exten'],
         request_body['flow'], request_body['timeout'], user_uuid)
     return transfer.to_dict(), 201
Example #8
0
 def post(self):
     tenant = Tenant.autodetect()
     user_uuid = get_token_user_uuid_from_request(self._auth_client)
     fax_infos = user_fax_creation_request_schema.load(request.args).data
     fax = self._service.send_fax_from_user(tenant.uuid,
                                            user_uuid,
                                            content=request.data,
                                            fax_infos=fax_infos)
     return fax_schema.dump(fax).data, 201
Example #9
0
 def get(self, conference_id):
     tenant = Tenant.autodetect()
     user_uuid = get_token_user_uuid_from_request(self._auth_client)
     participants = self._service.user_list_participants(
         tenant.uuid, user_uuid, conference_id)
     items = {
         'items': participant_schema.dump(participants, many=True).data,
         'total': len(participants),
     }
     return items, 200
Example #10
0
    def get(self):
        application_filter = request.args.get('application')
        application_instance_filter = request.args.get('application_instance')
        user_uuid = get_token_user_uuid_from_request()

        calls = self.calls_service.list_calls_user(user_uuid, application_filter, application_instance_filter)

        return {
            'items': call_schema.dump(calls, many=True),
        }, 200
Example #11
0
 def post(self):
     request_body = user_relocate_request_schema.load(
         request.get_json(force=True))
     user_uuid = get_token_user_uuid_from_request()
     relocate = self._relocates_service.create_from_user(
         request_body['initiator_call'], request_body['destination'],
         request_body['location'], request_body['completions'],
         request_body['timeout'], request_body['auto_answer'], user_uuid)
     result = relocate_schema.dump(relocate)
     return result, 201
Example #12
0
    def post(self):
        user_uuid = get_token_user_uuid_from_request()
        request_body = adhoc_conference_creation_schema.load(
            request.get_json(force=True))

        adhoc_conference = self._adhoc_conference_service.create_from_user(
            request_body['host_call_id'], request_body['participant_call_ids'],
            user_uuid)

        return adhoc_conference, 201
Example #13
0
 def get(self, meeting_uuid):
     tenant = Tenant.autodetect()
     user_uuid = get_token_user_uuid_from_request()
     participants = self._service.user_list_participants(
         tenant.uuid, user_uuid, meeting_uuid)
     items = {
         'items': participant_schema.dump(participants, many=True),
         'total': len(participants),
     }
     return items, 200
Example #14
0
 def get(self, greeting):
     user_uuid = get_token_user_uuid_from_request()
     greeting = _validate_greeting(greeting)
     data = self._service.get_user_greeting(user_uuid, greeting)
     headers = {
         'Content-Disposition': self.content_dispo_tpl.format(greeting)
     }
     return Response(response=data,
                     status=200,
                     headers=headers,
                     content_type='audio/wav')
Example #15
0
 def put(self, call_id):
     user_uuid = get_token_user_uuid_from_request()
     self.calls_service.answer_user(call_id, user_uuid)
     return '', 204
Example #16
0
 def delete(self, greeting):
     user_uuid = get_token_user_uuid_from_request()
     greeting = _validate_greeting(greeting)
     self._service.delete_user_greeting(user_uuid, greeting)
     return '', 204
Example #17
0
 def put(self, greeting):
     user_uuid = get_token_user_uuid_from_request()
     greeting = _validate_greeting(greeting)
     self._service.update_user_greeting(user_uuid, greeting, request.data)
     return '', 204
Example #18
0
 def head(self, greeting):
     user_uuid = get_token_user_uuid_from_request()
     greeting = _validate_greeting(greeting)
     self._service.validate_user_greeting_exists(user_uuid, greeting)
     return '', 200
Example #19
0
 def get(self, message_id):
     user_uuid = get_token_user_uuid_from_request()
     message_id = _validate_message_id(message_id)
     recording = self._voicemails_service.get_user_message_recording(
         user_uuid, message_id)
     return self._get_response(recording, message_id)
Example #20
0
 def put(self, relocate_uuid):
     user_uuid = get_token_user_uuid_from_request()
     self._relocates_service.cancel_from_user(relocate_uuid, user_uuid)
     return '', 204
Example #21
0
 def put(self, relocate_uuid):
     user_uuid = get_token_user_uuid_from_request(self._auth_client)
     self._relocates_service.complete_from_user(relocate_uuid, user_uuid)
     return '', 204
Example #22
0
 def get(self, message_id):
     user_uuid = get_token_user_uuid_from_request()
     message_id = _validate_message_id(message_id)
     message = self._voicemails_service.get_user_message(
         user_uuid, message_id)
     return voicemail_message_schema.dump(message)
Example #23
0
 def delete(self, transfer_id):
     user_uuid = get_token_user_uuid_from_request()
     self._transfers_service.cancel_from_user(transfer_id, user_uuid)
     return '', 204
Example #24
0
 def delete(self, meeting_uuid, participant_id):
     tenant = Tenant.autodetect()
     user_uuid = get_token_user_uuid_from_request()
     self._service.user_kick_participant(tenant.uuid, user_uuid,
                                         meeting_uuid, participant_id)
     return '', 204
Example #25
0
def _get_voicemail_id_from_request(auth_client, voicemails_service):
    user_uuid = get_token_user_uuid_from_request(auth_client)
    return voicemails_service.get_user_voicemail_id(user_uuid)
Example #26
0
 def put(self, transfer_id):
     user_uuid = get_token_user_uuid_from_request(self._auth_client)
     self._transfers_service.complete_from_user(transfer_id, user_uuid)
     return '', 204
Example #27
0
 def get(self):
     user_uuid = get_token_user_uuid_from_request()
     voicemail = self._voicemails_service.get_user_voicemail(user_uuid)
     return voicemail_schema.dump(voicemail)
Example #28
0
 def delete(self, message_id):
     user_uuid = get_token_user_uuid_from_request()
     message_id = _validate_message_id(message_id)
     self._voicemails_service.delete_user_message(user_uuid, message_id)
     return '', 204
Example #29
0
 def get(self, folder_id):
     user_uuid = get_token_user_uuid_from_request()
     folder_id = _validate_folder_id(folder_id)
     folder = self._voicemails_service.get_user_folder(user_uuid, folder_id)
     return voicemail_folder_schema.dump(folder)
Example #30
0
    def get(self):
        user_uuid = get_token_user_uuid_from_request()
        relocates = self._relocates_service.list_from_user(user_uuid)

        return {'items': relocate_schema.dump(relocates, many=True)}, 200