Skip to content

Commit 55cb21f

Browse files
authored
SWI-8574 Add wait to StopStream Verb (#262)
1 parent baea14d commit 55cb21f

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

bandwidth/models/bxml/verbs/start_recording.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ def __init__(
2323
Args:
2424
recording_available_url (str, optional): URL to send the Recording Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
2525
recording_available_method (str, optional): The HTTP method to use for the request to recordingAvailableUrl. GET or POST. Default value is POST.
26-
transcribe (str, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None.
26+
transcribe (bool, optional): A boolean value to indicate that recording should be transcribed. Transcription can succeed only for recordings of length greater than 500 milliseconds and less than 4 hours. Default is false. Defaults to None.
2727
transcription_available_url (str, optional): URL to send the Transcription Available event to once it has been processed. Does not accept BXML. May be a relative URL. Defaults to None.
2828
transcription_available_method (str, optional): The HTTP method to use for the request to transcriptionAvailableUrl. GET or POST. Default value is POST. Defaults to None.
2929
username (str, optional): The username to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
3030
password (str, optional): The password to send in the HTTP request to recordCompleteUrl, recordingAvailableUrl or transcriptionAvailableUrl. If specified, the URLs must be TLS-encrypted (i.e., https). Defaults to None.
3131
tag (str, optional): A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or <Tag> verb, or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None.
3232
file_format (str, optional): The audio format that the recording will be saved as: mp3 or wav. Default value is wav. Defaults to None. max_duration (str, optional): Maximum length of recording (in seconds). Max 10800 (3 hours). Default value is 60. Defaults to None.
33-
multi_channel (str, optional): A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false.
33+
multi_channel (bool, optional): A boolean value indicating whether or not the recording file should separate each side of the call into its own audio channel. Default value is false.
3434
3535
"""
3636
self.recording_available_url = recording_available_url

bandwidth/models/bxml/verbs/start_transcription.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ def __init__(
3131
:param transcription_event_method: The HTTP method to use for the request to transcriptionEventUrl. GET or POST. Default value is POST.
3232
:param username: The username to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
3333
:param password: The password to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
34-
:param destination: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
35-
:param stabilized: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
34+
:param destination: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
35+
:param stabilized: A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
3636
:param custom_params: These elements define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started.
3737
"""
3838
self.name = name

bandwidth/models/bxml/verbs/stop_stream.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@
1111
class StopStream(Verb):
1212

1313
def __init__(
14-
self, name: str
14+
self, name: str, wait: bool = None
1515
):
1616
"""Initialize a <StopStream> verb
1717
1818
Args:
1919
name (str): The name of the stream to stop. This is either the user selected name when sending the <StartStream> verb, or the system generated name returned in the Media Stream Started webhook if <StartStream> was sent with no name attribute.
20+
wait (bool, optional): If true, the BXML interpreter will wait for the stream to stop before processing the next verb.
2021
"""
2122
self.name = name
23+
self.wait = wait
2224
super().__init__(
2325
tag="StopStream",
2426
)
@@ -27,4 +29,5 @@ def __init__(
2729
def _attributes(self):
2830
return {
2931
"name": self.name,
32+
"wait": self.wait,
3033
}

test/unit/models/bxml/test_stop_stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
class TestStopStream(unittest.TestCase):
1414

1515
def setUp(self):
16-
self.stop_stream = StopStream(name="conf")
16+
self.stop_stream = StopStream(name="conf", wait=True)
1717

1818
def test_instance(self):
1919
assert isinstance(self.stop_stream, StopStream)
2020
assert isinstance(self.stop_stream, Verb)
2121

2222
def test_to_bxml(self):
23-
expected = '<StopStream name="conf" />'
23+
expected = '<StopStream name="conf" wait="True" />'
2424
assert expected == self.stop_stream.to_bxml()

0 commit comments

Comments
 (0)