Skip to content

SWI-8402 Add New StartStream Attributes #202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 11, 2025
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
84 changes: 48 additions & 36 deletions src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,43 +31,49 @@
@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 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).
* @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 destinationUsername (str, optional): The username to send in the
* `Authorization` header of the initial websocket
* connection to the `destination` URL.
* @param destinationPassword (str, optional): The password to send in the
* `Authorization` header of the initial websocket
* connection to the `destination` URL.
* @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 @@ -87,6 +93,12 @@ public class StartStream implements Verb {
@XmlAttribute
protected String destination;

@XmlAttribute
protected String destinationUsername;

@XmlAttribute
protected String destinationPassword;

@XmlAttribute
@Getter
protected String streamEventUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public class StartStreamVerbTest {
.mode("unidirectional")
.tracks(TracksEnum.inbound)
.destination("testurl.com")
.destinationUsername("destinationUsername")
.destinationPassword("destinationPassword")
.streamEventUrl("eventurl.com")
.streamEventMethod("POST")
.username("user")
Expand All @@ -50,7 +52,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\" 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>";
String expectedBxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Bxml><StartStream name=\"stream1\" mode=\"unidirectional\" tracks=\"inbound\" destination=\"testurl.com\" destinationUsername=\"destinationUsername\" destinationPassword=\"destinationPassword\" 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