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
49 changes: 39 additions & 10 deletions src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,43 @@
@EqualsAndHashCode
/**
*
* @param name (str, optional): A name to refer to this stream by. Used when sending <StopStream>. If not provided, it will default to the generated stream id as sent in the Media Stream Started webhook.
* @param tracks (str, optional): The part of the call to send a stream from. inbound, outbound or both. Default is inbound.
* @param destination (str, optional): A websocket URI to send the stream to. The audio from the specified tracks will be sent via websocket to this URL as base64-encoded PCMU/G711 audio. See below for more details on the websocket packet format.
* @param streamEventUrl (str, optional): URL to send the associated Webhook events to during this stream's lifetime. Does not accept BXML. May be a relative URL.
* @param streamEventMethod (str, optional): The HTTP method to use for the request to streamEventUrl. GET or POST. Default value is POST.
* @param username (str, optional): The username to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
* @param password (str, optional): The password to send in the HTTP request to streamEventUrl. If specified, the URLs must be TLS-encrypted (i.e., https).
* @param name (str, optional): A name to refer to this stream by.
* Used when sending <StopStream>. If not provided, it
* will default to the generated stream id as sent in
* the Media Stream Started webhook.
* @param mode (str, optional): The mode to use for the stream.
* unidirectional or bidirectional. Specifies whether
* the audio being streamed over the WebSocket is
* bidirectional (the service can both read and write
* audio over the WebSocket) or unidirectional
* (one-way, read-only). Default is unidirectional.
* @param tracks (str, optional): The part of the call to send a
* stream from. inbound, outbound or both. Default is
* inbound.
* @param destination (str, optional): A websocket URI to send the stream
* to. The audio from the specified tracks will be sent
* via websocket to this URL as base64-encoded
* PCMU/G711 audio. See below for more details on the
* websocket packet format.
* @param streamEventUrl (str, optional): URL to send the associated Webhook
* events to during this stream's lifetime. Does not
* accept BXML. May be a relative URL.
* @param streamEventMethod (str, optional): The HTTP method to use for the
* request to streamEventUrl. GET or POST. Default
* value is POST.
* @param username (str, optional): The username to send in the HTTP
* request to streamEventUrl. If specified, the URLs
* must be TLS-encrypted (i.e., https).
* @param password (str, optional): The password to send in the HTTP
* request to streamEventUrl. If specified, the URLs
* must be TLS-encrypted (i.e., https).
*
* Nested Verbs:
* @param StreamParam: (optional) You may specify up to 12 <StreamParam/> elements nested within a <StartStream> tag.
* These elements define optional user specified parameters that will be sent to the destination URL when the stream is first started.
* Nested Verbs:
* @param StreamParam: (optional) You may specify up to 12 <StreamParam/>
* elements nested within a <StartStream> tag.
* These elements define optional user specified
* parameters that will be sent to the destination URL
* when the stream is first started.
*
*/
public class StartStream implements Verb {
Expand All @@ -53,6 +79,9 @@ public class StartStream implements Verb {
@XmlAttribute
protected String name;

@XmlAttribute
protected String mode;

@XmlAttribute
@Default
protected CallDirectionEnum tracks = CallDirectionEnum.INBOUND;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class StartStreamVerbTest {
.build();
StartStream startStream = StartStream.builder()
.name("stream1")
.mode("unidirectional")
.tracks(CallDirectionEnum.INBOUND)
.destination("testurl.com")
.streamEventUrl("eventurl.com")
Expand All @@ -49,7 +50,7 @@ public class StartStreamVerbTest {
@Test
public void startStreamVerbWorks() throws JAXBException {
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><StartStream name=\"stream1\" tracks=\"INBOUND\" destination=\"testurl.com\" streamEventUrl=\"eventurl.com\" streamEventMethod=\"POST\" username=\"user\" password=\"pass\"><StreamParam name=\"name1\" value=\"value1\"/><StreamParam name=\"name2\" value=\"value2\"/></StartStream></Bxml>";
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><StartStream name=\"stream1\" mode=\"unidirectional\" tracks=\"INBOUND\" destination=\"testurl.com\" streamEventUrl=\"eventurl.com\" streamEventMethod=\"POST\" username=\"user\" password=\"pass\"><StreamParam name=\"name1\" value=\"value1\"/><StreamParam name=\"name2\" value=\"value2\"/></StartStream></Bxml>";

assertThat(new Bxml().with(startStream).toBxml(jaxbContext), is(expectedBxml));
}
Expand Down