def list(self, limit=20, offset=0): return self.client.request( 'GET', ('Endpoint', ), to_param_dict(self.list, locals()), objects_type=Endpoint, response_type=ListResponseObject)
def list(self, subaccount=None, call_direction=None, call_direction__lt=None, call_direction__lte=None, call_direction__gt=None, call_direction__gte=None, end_time__lt=None, end_time__lte=None, end_time__gt=None, end_time__gte=None, end_time=None, from_number=None, to_number=None, bill_duration=None, limit=20, offset=0, status=None, parent_call_uuid=None, hangup_cause_code=None, hangup_source=None): return self.client.request( 'GET', ('Call', ), to_param_dict(self.list, locals()), response_type=ListResponseObject, )
def list(self, limit=20, offset=0): return self.client.request( 'GET', ('Endpoint', ), to_param_dict(self.list, locals()), objects_type=Endpoint, response_type=ListResponseObject, is_voice_request=True)
def list(self, subaccount=None, call_uuid=None, add_time__gt=None, add_time__gte=None, add_time__lt=None, add_time__lte=None, add_time=None, limit=20, offset=0): if subaccount: if isinstance(subaccount, Subaccount): subaccount = subaccount.id if add_time__gt and is_valid_time_comparison(add_time__gt): add_time__gt = str(add_time__gt) if add_time__gte and is_valid_time_comparison(add_time__gte): add_time__gte = str(add_time__gte) if add_time__lt and is_valid_time_comparison(add_time__lt): add_time__lt = str(add_time__lt) if add_time__lte and is_valid_time_comparison(add_time__lte): add_time__lte = str(add_time__lte) if add_time and is_valid_time_comparison(add_time): add_time = str(add_time) return self.client.request('GET', ('Recording', ), to_param_dict(self.list, locals()), objects_type=Recording, response_type=ListResponseObject, is_voice_request=True)
def list(self, subaccount=None, call_direction=None, call_direction__lt=None, call_direction__lte=None, call_direction__gt=None, call_direction__gte=None, end_time__lt=None, end_time__lte=None, end_time__gt=None, end_time__gte=None, end_time=None, from_number=None, to_number=None, bill_duration=None, limit=20, offset=0, status=None, parent_call_uuid=None, hangup_cause_code=None, hangup_source=None): return self.client.request('GET', ('Call', ), to_param_dict(self.list, locals()), response_type=ListResponseObject, is_voice_request=True)
def create(self, from_, to_, answer_url, answer_method='POST', ring_url=None, ring_method='POST', hangup_url=None, hangup_method='POST', fallback_url=None, fallback_method='POST', caller_name=None, send_digits=None, send_on_preanswer=None, time_limit=None, hangup_on_ring=None, machine_detection=None, machine_detection_time=5000, machine_detection_url=None, machine_detection_method='POST', sip_headers=None, ring_timeout=120, parent_call_uuid=None, error_if_parent_not_found=False): if from_ in to_.split('<'): raise ValidationError('src and destination cannot overlap') return self.client.request('POST', ('Call', ), to_param_dict(self.create, locals()), is_voice_request=True)
def update(self, action, trigger_source, to, role): return self.client.request('POST', ('phlo', self.phlo_id, self.node_type, self.node_id), to_param_dict(self.update, locals()))
def create(self, from_, to_, answer_url, answer_method='POST', ring_url=None, ring_method='POST', hangup_url=None, hangup_method='POST', fallback_url=None, fallback_method='POST', caller_name=None, send_digits=None, send_on_preanswer=False, time_limit=None, hangup_on_ring=None, machine_detection=None, machine_detection_time=5000, machine_detection_url=None, machine_detection_method='POST', sip_headers=None, ring_timeout=120, parent_call_uuid=None, error_if_parent_not_found=False): if from_ in to_.split('<'): raise ValidationError('src and destination cannot overlap') return self.client.request('POST', ('Call', ), to_param_dict(self.create, locals()))
def list(self, subaccount=None, limit=20, offset=0): if subaccount: if isinstance(subaccount, Subaccount): subaccount = subaccount.id return self.client.request('GET', ('Application', ), to_param_dict(self.list, locals()), response_type=ListResponseObject, objects_type=Application)
def member_speak(self, member_id, text, voice="WOMAN", #Changed the value to "WOMAN" since the default value is WOMAN language=None): return self.client.conferences.member_speak( self.conference_name, member_id, text, **to_param_dict( self.member_speak, locals()) )
def update(self, number, app_id=None, subaccount=None, alias=None, verification_info=None): return self.client.request('POST', ('Number', number), to_param_dict(self.update, locals()))
def update(self, legs=None, aleg_url=None, aleg_method=None, bleg_url=None, bleg_method=None): return self.client.calls.update(self.id, **to_param_dict(self.update, locals()))
def play(self, call_uuid, urls, length=None, legs=None, loop=None, mix=None): return self.start_playing(**to_param_dict(self.play, locals()))
def update( self, identity_id, country_iso=None, salutation=None, first_name=None, last_name=None, birth_place=None, birth_date=None, nationality=None, id_nationality=None, id_issue_date=None, id_type=None, id_number=None, address_line1=None, address_line2=None, city=None, region=None, postal_code=None, alias=None, business_name=None, fiscal_identification_code=None, street_code=None, municipal_code=None, subaccount=None, file_to_upload=None, # Value in doc 'file' auto_correct_address=None, callback_url=None, ): if file_to_upload: file_extension = file_to_upload.strip().split('.')[-1].lower() if file_extension not in ['jpg', 'jpeg', 'png', 'pdf']: raise ValidationError( 'File format of the file to be uploaded should be one of JPG, JPEG, PNG or PDF' ) content_types = { 'jpeg': 'image/jpeg', 'jpg': 'image/jpeg', 'png': 'image/png', 'pdf': 'application/pdf', } import os files = { 'file': (file_to_upload.split(os.sep)[-1], open(file_to_upload, 'rb'), content_types[file_extension]) } else: files = {'file': ''} data_to_send = to_param_dict(self.create, locals()) return self.client.request('POST', ('Verification', 'Identity', identity_id), data_to_send, files=files)
def update(self, call_uuid, legs=None, aleg_url=None, aleg_method=None, bleg_url=None, bleg_method=None): return self.client.request('POST', ('Call', call_uuid), to_param_dict(self.update, locals()))
def start_playing(self, call_uuid, urls, length=None, legs=None, loop=None, mix=None): return self.client.request('POST', ('Call', call_uuid, 'Play'), to_param_dict(self.play, locals()))
def update(self, call_uuid, legs=None, aleg_url=None, aleg_method=None, bleg_url=None, bleg_method=None): return self.client.calls.update(call_uuid, **to_param_dict(self.update, locals()))
def create(self, numbers, carrier, region, number_type=None, app_id=None, subaccount=None): return self.client.request('POST', ('Number', ), to_param_dict(self.create, locals()))
def record(self, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_method=None): return self.client.conferences.record( self.conference_name, **to_param_dict(self.member_speak, locals()))
def start_speaking(self, text, voice=None, language=None, legs=None, loop=None, mix=None): return self.client.calls.start_speaking( self.id, **to_param_dict(self.start_playing, locals()))
def list(self, subaccount=None, limit=20, offset=0): if subaccount: if isinstance(subaccount, Subaccount): subaccount = subaccount.id return self.client.request( 'GET', ('Application', ), to_param_dict(self.list, locals()), response_type=ListResponseObject, objects_type=Application)
def member_speak(self, conference_name, member_id, text, voice=None, language=None): return self.client.request( 'POST', ('Conference', conference_name, 'Member', member_id, 'Speak'), to_param_dict(self.member_speak, locals()))
def record(self, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_method=None): return self.client.conferences.record(self.conference_name, **to_param_dict( self.member_speak, locals()))
def list_ids(self, call_direction=None, from_number=None, to_number=None, limit=20, offset=0, ): params = to_param_dict(self.list_ids, locals()) params.update({'status': 'live'}) return self.client.request('GET', ('Call',), params)
def start_recording(self, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_method=None): return self.client.calls.start_recording( self.id, **to_param_dict(self.start_recording, locals()))
def record(self, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_mathod=None): return self.client.calls.record(self.id, **to_param_dict(self.record, locals()))
def create(self, country_iso, salutation, first_name, last_name, address_line1, address_line2, city, region, postal_code, address_proof_type, alias=None, file_to_upload=None, auto_correct_address=None, fiscal_identification_code=None, street_code=None, municipal_code=None, callback_url=None): if country_iso == 'ES' and not fiscal_identification_code: raise ValidationError( 'The parameter fiscal_identification_code is required for Spain numbers' ) if country_iso == 'DK' and not all(street_code, municipal_code): raise ValidationError( 'The parameters street_code and municipal_code are required for Denmark numbers' ) if file_to_upload: file_extension = file_to_upload.strip().split('.')[-1].lower() if file_extension not in ['jpg', 'jpeg', 'png', 'pdf']: raise ValidationError( 'File format of the file to be uploaded should be one of JPG, JPEG, PNG or PDF' ) content_types = { 'jpeg': 'image/jpeg', 'jpg': 'image/jpeg', 'png': 'image/png', 'pdf': 'application/pdf', } import os files = { 'file': (file_to_upload.split(os.sep)[-1], open(file_to_upload, 'rb'), content_types[file_extension]) } else: files = {'file': ''} data_to_send = to_param_dict(self.create, locals()) return self.client.request('POST', ('Verification', 'Address'), data_to_send, files=files)
def update(self, identity_id, country_iso=None, salutation=None, first_name=None, last_name=None, birth_place=None, birth_date=None, nationality=None, id_nationality=None, id_issue_date=None, id_type=None, id_number=None, address_line1=None, address_line2=None, city=None, region=None, postal_code=None, alias=None, business_name=None, fiscal_identification_code=None, street_code=None, municipal_code=None, subaccount=None, file_to_upload=None, auto_correct_address=None, callback_url=None): if file_to_upload: file_extension = file_to_upload.strip().split('.')[-1].lower() if file_extension not in ['jpg', 'jpeg', 'png', 'pdf']: raise ValidationError( 'File format of the file to be uploaded should be one of JPG, JPEG, PNG or PDF' ) content_types = { 'jpeg': 'image/jpeg', 'jpg': 'image/jpeg', 'png': 'image/png', 'pdf': 'application/pdf', } import os files = { 'file': (file_to_upload.split(os.sep)[-1], open( file_to_upload, 'rb'), content_types[file_extension]) } else: files = {'file': ''} data_to_send = to_param_dict(self.create, locals()) return self.client.request( 'POST', ('Verification', 'Identity', identity_id), data_to_send, files=files)
def start_speaking(self, call_uuid, text, voice=None, language=None, legs=None, loop=None, mix=None): return self.client.request('POST', ('Call', call_uuid, 'Speak'), to_param_dict(self.start_speaking, locals()))
def start_speaking(self, call_uuid, text, voice=None, language=None, legs=None, loop=None, mix=None): return self.client.request( 'POST', ('Call', call_uuid, 'Speak'), to_param_dict(self.start_speaking, locals()))
def start_speaking(self, text, voice=None, language=None, legs=None, loop=None, mix=None): return self.client.calls.start_speaking(self.id, **to_param_dict( self.start_playing, locals()))
def record(self, call_uuid, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_mathod=None): return self.start_recording(**to_param_dict(self.start_recording, locals()))
def list_ids( self, call_direction=None, from_number=None, to_number=None, limit=20, offset=0, ): params = to_param_dict(self.list_ids, locals()) params.update({'status': 'live'}) return self.client.request('GET', ('Call', ), params)
def member_speak(self, conference_name, member_id, text, voice="WOMAN", #Changed the value to "WOMAN" since the default value is WOMAN language=None ): return self.client.request( 'POST', ('Conference', conference_name, 'Member', member_id, 'Speak'), to_param_dict(self.member_speak, locals()) )
def record(self, call_uuid, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_method=None): return self.start_recording( **to_param_dict(self.start_recording, locals()))
def speak(self, call_uuid, text, voice=None, language=None, legs=None, loop=None, mix=None, is_voice_request=True): return self.client.calls.speak( self.id, **to_param_dict(self.start_playing, locals()))
def start_recording(self, call_uuid, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_mathod=None): return self.client.request( 'POST', ('Call', call_uuid, 'Record'), to_param_dict(self.start_recording, locals()))
def search(self, country_iso, type=None, pattern=None, region=None, services=None, lata=None, rate_center=None, limit=None, offset=None): return self.client.request('GET', ('PhoneNumber', ), to_param_dict(self.search, locals()))
def create(self, country_iso, salutation, first_name, last_name, address_line1, address_line2, city, region, postal_code, address_proof_type, alias=None, file_to_upload=None, auto_correct_address=None, fiscal_identification_code=None, street_code=None, municipal_code=None, callback_url=None): if country_iso == 'ES' and not fiscal_identification_code: raise ValidationError( 'The parameter fiscal_identification_code is required for Spain numbers' ) if country_iso == 'DK' and not all(street_code, municipal_code): raise ValidationError( 'The parameters street_code and municipal_code are required for Denmark numbers' ) if file_to_upload: file_extension = file_to_upload.strip().split('.')[-1].lower() if file_extension not in ['jpg', 'jpeg', 'png', 'pdf']: raise ValidationError( 'File format of the file to be uploaded should be one of JPG, JPEG, PNG or PDF' ) content_types = { 'jpeg': 'image/jpeg', 'jpg': 'image/jpeg', 'png': 'image/png', 'pdf': 'application/pdf', } import os files = { 'file': (file_to_upload.split(os.sep)[-1], open( file_to_upload, 'rb'), content_types[file_extension]) } else: files = {'file': ''} data_to_send = to_param_dict(self.create, locals()) return self.client.request( 'POST', ('Verification', 'Address'), data_to_send, files=files)
def start_recording(self, call_uuid, time_limit=None, file_format=None, transcription_type=None, transcription_url=None, transcription_method=None, callback_url=None, callback_mathod=None): return self.client.request('POST', ('Call', call_uuid, 'Record'), to_param_dict(self.start_recording, locals()))
def start_playing(self, call_uuid, urls, length=None, legs=None, loop=None, mix=None, callback_url=None, callback_method=None): return self.client.request('POST', ('Call', call_uuid, 'Play'), to_param_dict(self.play, locals()), is_voice_request=True)
def list(self, country_iso=None, customer_name=None, alias=None, verification_status=None, limit=20, offset=0): return self.client.request( 'GET', ('Verification', 'Identity', ), to_param_dict(self.list, locals()), response_type=ListResponseObject, objects_type=Identity)
def search(self, country_iso, type=None, pattern=None, region=None, services=None, lata=None, rate_center=None, limit=None, offset=None, eligible=None): return self.client.request('GET', ('PhoneNumber', ), to_param_dict(self.search, locals()))
def list(self, type=None, number_startswith=None, subaccount=None, alias=None, services=None, limit=20, offset=0): return self.client.request( 'GET', ('Number', ), to_param_dict(self.list, locals()), objects_type=Number, response_type=ListResponseObject, )
def update(self, answer_url, answer_method='POST', hangup_url=None, hangup_method='POST', fallback_answer_url=None, fallback_method='POST', message_url=None, message_method='POST', default_number_app=False, default_endpoint_app=False, subaccount=None, log_incoming_messages=True): params = to_param_dict(self.update, locals()) self.__dict__.update(params) return self.client.applications.update(self.id, **params)
def update(self, app_id, answer_url, answer_method='POST', hangup_url=None, hangup_method='POST', fallback_answer_url=None, fallback_method='POST', message_url=None, message_method='POST', default_number_app=False, default_endpoint_app=False, subaccount=None, log_incoming_messages=True): if subaccount: if isinstance(subaccount, Subaccount): subaccount = subaccount.id return self.client.request('POST', ('Application', app_id), to_param_dict(self.update, locals()))
def list(self, subaccount=None, call_uuid=None, add_time__gt=None, add_time__gte=None, add_time__lt=None, add_time__lte=None, add_time=None, limit=20, offset=0): if subaccount: if isinstance(subaccount, Subaccount): subaccount = subaccount.id if add_time__gt and is_valid_time_comparison(add_time__gt): add_time__gt = str(add_time__gt) if add_time__gte and is_valid_time_comparison(add_time__gte): add_time__gte = str(add_time__gte) if add_time__lt and is_valid_time_comparison(add_time__lt): add_time__lt = str(add_time__lt) if add_time__lte and is_valid_time_comparison(add_time__lte): add_time__lte = str(add_time__lte) if add_time and is_valid_time_comparison(add_time): add_time = str(add_time) return self.client.request( 'GET', ('Recording', ), to_param_dict(self.list, locals()), objects_type=Recording, response_type=ListResponseObject, )
def delete(self, app_id): return self.client.request('DELETE', ('Application', app_id), to_param_dict(self.update, locals()))
def member_play(self, conference_name, member_id, url): return self.client.request( 'POST', ('Conference', conference_name, 'Member', member_id, 'Play'), to_param_dict(self.member_play, locals()))
def member_speak(self, member_id, text, voice=None, language=None): return self.client.conferences.member_speak(self.conference_name, member_id, text, **to_param_dict( self.member_speak, locals()))