Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bandwidth/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions bandwidth/tests/test_bxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -151,7 +152,7 @@ def test_record(self):
fallback_password="fpass"
)
response.add_verb(record)
expected_bxml = '<?xml version="1.0" encoding="UTF-8"?><Response><Record tag="tag" username="user" password="pass" recordCompleteUrl="https://record.url.server/record" recordCompleteMethod="POST" recordingAvailableUrl="https://record.url.server/available" recordingAvailableMethod="GET" terminatingDigits="#" maxDuration="90" fileFormat="mp3" transcribe="false" transcriptionAvailableUrl="https://transcribe.url.server/available" transcriptionAvailableMethod="POST" silenceTimeout="90" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
expected_bxml = '<?xml version="1.0" encoding="UTF-8"?><Response><Record tag="tag" username="user" password="pass" recordCompleteUrl="https://record.url.server/record" recordCompleteMethod="POST" recordingAvailableUrl="https://record.url.server/available" recordingAvailableMethod="GET" terminatingDigits="#" maxDuration="90" fileFormat="mp3" detectLanguage="true" transcribe="false" transcriptionAvailableUrl="https://transcribe.url.server/available" transcriptionAvailableMethod="POST" silenceTimeout="90" recordCompleteFallbackUrl="https://test.com" recordCompleteFallbackMethod="GET" fallbackUsername="fuser" fallbackPassword="fpass"/></Response>'
assert response.to_bxml() == expected_bxml

def test_redirect(self):
Expand Down Expand Up @@ -445,5 +446,3 @@ def test_stop_stream_bxml_verb(self):
actual = response.to_bxml()

assert expected == actual


8 changes: 7 additions & 1 deletion bandwidth/voice/bxml/verbs/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 7 additions & 1 deletion bandwidth/voice/bxml/verbs/start_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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"
Expand Down
9 changes: 7 additions & 2 deletions bandwidth/voice/models/transcribe_recording_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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',
Expand All @@ -35,6 +36,7 @@ class TranscribeRecordingRequest(object):
}

def __init__(self,
detect_language=None,
callback_url=None,
callback_method=None,
username=None,
Expand All @@ -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
Expand All @@ -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')
Expand All @@ -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,
Expand Down