Skip to content

Commit f961f8d

Browse files
authored
SWI-8402 Add New StartStream Attributes (#202)
1 parent 8100bd1 commit f961f8d

File tree

2 files changed

+51
-37
lines changed

2 files changed

+51
-37
lines changed

src/main/java/com/bandwidth/sdk/model/bxml/StartStream.java

Lines changed: 48 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -31,43 +31,49 @@
3131
@EqualsAndHashCode
3232
/**
3333
*
34-
* @param name (str, optional): A name to refer to this stream by.
35-
* Used when sending <StopStream>. If not provided, it
36-
* will default to the generated stream id as sent in
37-
* the Media Stream Started webhook.
38-
* @param mode (str, optional): The mode to use for the stream.
39-
* unidirectional or bidirectional. Specifies whether
40-
* the audio being streamed over the WebSocket is
41-
* bidirectional (the service can both read and write
42-
* audio over the WebSocket) or unidirectional
43-
* (one-way, read-only). Default is unidirectional.
44-
* @param tracks (str, optional): The part of the call to send a
45-
* stream from. inbound, outbound or both. Default is
46-
* inbound.
47-
* @param destination (str, optional): A websocket URI to send the stream
48-
* to. The audio from the specified tracks will be sent
49-
* via websocket to this URL as base64-encoded
50-
* PCMU/G711 audio. See below for more details on the
51-
* websocket packet format.
52-
* @param streamEventUrl (str, optional): URL to send the associated Webhook
53-
* events to during this stream's lifetime. Does not
54-
* accept BXML. May be a relative URL.
55-
* @param streamEventMethod (str, optional): The HTTP method to use for the
56-
* request to streamEventUrl. GET or POST. Default
57-
* value is POST.
58-
* @param username (str, optional): The username to send in the HTTP
59-
* request to streamEventUrl. If specified, the URLs
60-
* must be TLS-encrypted (i.e., https).
61-
* @param password (str, optional): The password to send in the HTTP
62-
* request to streamEventUrl. If specified, the URLs
63-
* must be TLS-encrypted (i.e., https).
34+
* @param name (str, optional): A name to refer to this stream by.
35+
* Used when sending <StopStream>. If not provided, it
36+
* will default to the generated stream id as sent in
37+
* the Media Stream Started webhook.
38+
* @param mode (str, optional): The mode to use for the stream.
39+
* unidirectional or bidirectional. Specifies whether
40+
* the audio being streamed over the WebSocket is
41+
* bidirectional (the service can both read and write
42+
* audio over the WebSocket) or unidirectional
43+
* (one-way, read-only). Default is unidirectional.
44+
* @param tracks (str, optional): The part of the call to send a
45+
* stream from. inbound, outbound or both. Default is
46+
* inbound.
47+
* @param destination (str, optional): A websocket URI to send the stream
48+
* to. The audio from the specified tracks will be sent
49+
* via websocket to this URL as base64-encoded
50+
* PCMU/G711 audio. See below for more details on the
51+
* websocket packet format.
52+
* @param destinationUsername (str, optional): The username to send in the
53+
* `Authorization` header of the initial websocket
54+
* connection to the `destination` URL.
55+
* @param destinationPassword (str, optional): The password to send in the
56+
* `Authorization` header of the initial websocket
57+
* connection to the `destination` URL.
58+
* @param streamEventUrl (str, optional): URL to send the associated Webhook
59+
* events to during this stream's lifetime. Does not
60+
* accept BXML. May be a relative URL.
61+
* @param streamEventMethod (str, optional): The HTTP method to use for the
62+
* request to streamEventUrl. GET or POST. Default
63+
* value is POST.
64+
* @param username (str, optional): The username to send in the HTTP
65+
* request to streamEventUrl. If specified, the URLs
66+
* must be TLS-encrypted (i.e., https).
67+
* @param password (str, optional): The password to send in the HTTP
68+
* request to streamEventUrl. If specified, the URLs
69+
* must be TLS-encrypted (i.e., https).
6470
*
65-
* Nested Verbs:
66-
* @param StreamParam: (optional) You may specify up to 12 <StreamParam/>
67-
* elements nested within a <StartStream> tag.
68-
* These elements define optional user specified
69-
* parameters that will be sent to the destination URL
70-
* when the stream is first started.
71+
* Nested Verbs:
72+
* @param StreamParam: (optional) You may specify up to 12 <StreamParam/>
73+
* elements nested within a <StartStream> tag.
74+
* These elements define optional user specified
75+
* parameters that will be sent to the destination URL
76+
* when the stream is first started.
7177
*
7278
*/
7379
public class StartStream implements Verb {
@@ -87,6 +93,12 @@ public class StartStream implements Verb {
8793
@XmlAttribute
8894
protected String destination;
8995

96+
@XmlAttribute
97+
protected String destinationUsername;
98+
99+
@XmlAttribute
100+
protected String destinationPassword;
101+
90102
@XmlAttribute
91103
@Getter
92104
protected String streamEventUrl;

src/test/java/com/bandwidth/sdk/unit/models/bxml/StartStreamVerbTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ public class StartStreamVerbTest {
4040
.mode("unidirectional")
4141
.tracks(TracksEnum.inbound)
4242
.destination("testurl.com")
43+
.destinationUsername("destinationUsername")
44+
.destinationPassword("destinationPassword")
4345
.streamEventUrl("eventurl.com")
4446
.streamEventMethod("POST")
4547
.username("user")
@@ -50,7 +52,7 @@ public class StartStreamVerbTest {
5052
@Test
5153
public void startStreamVerbWorks() throws JAXBException {
5254
JAXBContext jaxbContext = JAXBContext.newInstance(Bxml.class);
53-
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>";
55+
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>";
5456

5557
assertThat(new Bxml().with(startStream).toBxml(jaxbContext), is(expectedBxml));
5658
}

0 commit comments

Comments
 (0)