diff --git a/bandwidth/tests/test_api.py b/bandwidth/tests/test_api.py index 3330b270..a8bce90c 100644 --- a/bandwidth/tests/test_api.py +++ b/bandwidth/tests/test_api.py @@ -222,7 +222,7 @@ def test_successful_create_and_get_call(self, voice_client): create_response = voice_client.create_call(BW_ACCOUNT_ID, call_body) create_response_body = create_response.body - time.sleep(3) + time.sleep(15) get_response = voice_client.get_call(BW_ACCOUNT_ID, create_response.body.call_id) get_response_body = get_response.body diff --git a/bandwidth/tests/test_bxml.py b/bandwidth/tests/test_bxml.py index 24c52f2d..92bb82e3 100644 --- a/bandwidth/tests/test_bxml.py +++ b/bandwidth/tests/test_bxml.py @@ -141,6 +141,7 @@ def test_record(self): terminating_digits="#", max_duration=90, file_format="mp3", + detect_language=True, transcribe=False, transcription_available_url="https://transcribe.url.server/available", transcription_available_method="POST", @@ -151,7 +152,7 @@ def test_record(self): fallback_password="fpass" ) response.add_verb(record) - expected_bxml = '' + expected_bxml = '' assert response.to_bxml() == expected_bxml def test_redirect(self): @@ -445,5 +446,3 @@ def test_stop_stream_bxml_verb(self): actual = response.to_bxml() assert expected == actual - - diff --git a/bandwidth/voice/bxml/verbs/record.py b/bandwidth/voice/bxml/verbs/record.py index d38b3a67..007c65d5 100644 --- a/bandwidth/voice/bxml/verbs/record.py +++ b/bandwidth/voice/bxml/verbs/record.py @@ -17,7 +17,7 @@ class Record(AbstractBxmlVerb): def __init__(self, tag=None, username=None, password=None, record_complete_url=None, record_complete_method=None, recording_available_url=None, recording_available_method=None, terminating_digits=None, max_duration=None, - file_format=None, transcribe=None, transcription_available_url=None, transcription_available_method=None, + file_format=None, detect_language=None, transcribe=None, transcription_available_url=None, transcription_available_method=None, silence_timeout=None, record_complete_fallback_url=None, record_complete_fallback_method=None, fallback_username=None, fallback_password=None): """ @@ -33,6 +33,7 @@ def __init__(self, tag=None, username=None, password=None, record_complete_url=N :param str terminating_digits: Digits to terminate the recording :param int max_duration: Max duration to record in seconds :param str file_format: The file format to save the recording in + :param bool detect_language: Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. :param bool transcribe: True to transcribe the recording on completion, False otherwise :param str transcription_available_url: URL to send the transcriptionAvailable event to. :param str transcription_available_method: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST @@ -52,6 +53,7 @@ def __init__(self, tag=None, username=None, password=None, record_complete_url=N self.terminating_digits = terminating_digits self.max_duration = max_duration self.file_format = file_format + self.detect_language = detect_language self.transcribe = transcribe self.transcription_available_url = transcription_available_url self.transcription_available_method = transcription_available_method @@ -83,6 +85,10 @@ def to_bxml(self): root.set("maxDuration", str(self.max_duration)) if self.file_format is not None: root.set("fileFormat", self.file_format) + if self.detect_language is not None: + #Convert True to "true", or False to "false" + strn = "true" if self.detect_language else "false" + root.set("detectLanguage", strn) if self.transcribe is not None: #Convert True to "true", or False to "false" strn = "true" if self.transcribe else "false" diff --git a/bandwidth/voice/bxml/verbs/start_recording.py b/bandwidth/voice/bxml/verbs/start_recording.py index 887eef99..716eb904 100644 --- a/bandwidth/voice/bxml/verbs/start_recording.py +++ b/bandwidth/voice/bxml/verbs/start_recording.py @@ -16,7 +16,7 @@ class StartRecording(AbstractBxmlVerb): def __init__(self, tag=None, username=None, password=None, recording_available_url=None, recording_available_method=None, - file_format=None, multi_channel=None, transcribe=None, transcription_available_url=None, transcription_available_method=None): + file_format=None, multi_channel=None, detect_language=None, transcribe=None, transcription_available_url=None, transcription_available_method=None): """ Initializes the Record class with the following parameters @@ -27,6 +27,7 @@ def __init__(self, tag=None, username=None, password=None, recording_available_u :param str recording_available_method: HTTP method for record available callback :param str file_format: The file format to save the recording in :param bool multi_channel: Whether or not to record the channels separately (default is false, 1 recording) + :param bool detect_language: Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. :param bool transcribe: True to transcribe the recording on completion, False otherwise :param str transcription_available_url: URL to send the transcriptionAvailable event to. :param str transcription_available_method: The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST @@ -38,6 +39,7 @@ def __init__(self, tag=None, username=None, password=None, recording_available_u self.recording_available_method = recording_available_method self.file_format = file_format self.multi_channel = multi_channel + self.detect_language = detect_language self.transcribe = transcribe self.transcription_available_url = transcription_available_url self.transcription_available_method = transcription_available_method @@ -60,6 +62,10 @@ def to_bxml(self): #Convert True to "true", or False to "false" strn = "true" if self.multi_channel else "false" root.set("multiChannel", strn) + if self.detect_language is not None: + #Convert True to "true", or False to "false" + strn = "true" if self.detect_language else "false" + root.set("detectLanguage", strn) if self.transcribe is not None: #Convert True to "true", or False to "false" strn = "true" if self.transcribe else "false" diff --git a/bandwidth/voice/models/transcribe_recording_request.py b/bandwidth/voice/models/transcribe_recording_request.py index 9af4ea51..e2edc941 100644 --- a/bandwidth/voice/models/transcribe_recording_request.py +++ b/bandwidth/voice/models/transcribe_recording_request.py @@ -9,12 +9,12 @@ class TranscribeRecordingRequest(object): - """Implementation of the 'TranscribeRecordingRequest' model. TODO: type model description here. Attributes: + detect_language (bool): Indicates that the recording may not be in English, and the transcription service will need to detect the dominant language the recording is in and transcribe accordingly. Current supported languages are English, French, and Spanish. callback_url (string): TODO: type description here. callback_method (CallbackMethodEnum): TODO: type description here. username (string): TODO: type description here. @@ -26,6 +26,7 @@ class TranscribeRecordingRequest(object): # Create a mapping from Model property names to API property names _names = { + "detect_language": "detectLanguage", "callback_url": 'callbackUrl', "callback_method": 'callbackMethod', "username": 'username', @@ -35,6 +36,7 @@ class TranscribeRecordingRequest(object): } def __init__(self, + detect_language=None, callback_url=None, callback_method=None, username=None, @@ -44,6 +46,7 @@ def __init__(self, """Constructor for the TranscribeRecordingRequest class""" # Initialize members of the class + self.detect_language = detect_language self.callback_url = callback_url self.callback_method = callback_method self.username = username @@ -69,6 +72,7 @@ def from_dictionary(cls, return None # Extract variables from the dictionary + detect_language = dictionary.get('detectLanguage') callback_url = dictionary.get('callbackUrl') callback_method = dictionary.get('callbackMethod') username = dictionary.get('username') @@ -77,7 +81,8 @@ def from_dictionary(cls, callback_timeout = dictionary.get('callbackTimeout') # Return an object of this model - return cls(callback_url, + return cls(detect_language, + callback_url, callback_method, username, password,