Skip to content

Commit 5f7c9dc

Browse files
authored
Merge pull request #207 from opentok/feature/sip-video-flag
[WIP DEVX-5641, 5660] add video flag to sip properties
2 parents 216c2f8 + 9586304 commit 5f7c9dc

File tree

3 files changed

+222
-150
lines changed

3 files changed

+222
-150
lines changed

src/main/java/com/opentok/SipProperties.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class SipProperties {
2020
private String password = null;
2121
private String headersJsonStartingWithXDash = null;
2222
private Boolean secure = false;
23+
private Boolean video = false;
24+
private Boolean observeForceMute = false;
2325

2426
private SipProperties(Builder builder) {
2527
this.sipUri = builder.sipUri;
@@ -28,6 +30,8 @@ private SipProperties(Builder builder) {
2830
this.password = builder.password;
2931
this.headersJsonStartingWithXDash = builder.headersJsonStartingWithXDash;
3032
this.secure = builder.secure;
33+
this.video = builder.video;
34+
this.observeForceMute = builder.observeForceMute;
3135
}
3236

3337
/**
@@ -42,6 +46,8 @@ public static class Builder {
4246
private String password = null;
4347
private String headersJsonStartingWithXDash = null;
4448
private boolean secure = false;
49+
private boolean video = false;
50+
private boolean observeForceMute = false;
4551

4652

4753
/**
@@ -60,6 +66,7 @@ public Builder sipUri(String sipUri) {
6066
this.sipUri = sipUri;
6167
return this;
6268
}
69+
6370
/**
6471
* Call this method to set the SIP <code>from</code> field (optional).
6572
*
@@ -76,6 +83,7 @@ public Builder from(String from) {
7683
this.from = from;
7784
return this;
7885
}
86+
7987
/**
8088
* Call this method to set the username for the SIP gateway provider (optional).
8189
*
@@ -99,6 +107,7 @@ public Builder password(String password) {
99107
this.password = password;
100108
return this;
101109
}
110+
102111
/**
103112
* Call this method to define custom headers to be added to the SIP ​INVITE​
104113
* initiated from OpenTok to the your SIP platform.
@@ -114,6 +123,7 @@ public Builder headersJsonStartingWithXDash(String headersJsonStartingWithXDash)
114123
this.headersJsonStartingWithXDash = headersJsonStartingWithXDash;
115124
return this;
116125
}
126+
117127
/**
118128
* Call this method and pass in <code>true</code> to indicate that the media
119129
* must be transmitted encrypted. Pass in <code>false​</code>, the default, if encryption
@@ -128,6 +138,34 @@ public Builder secure(boolean secure) {
128138
this.secure = secure;
129139
return this;
130140
}
141+
142+
/**
143+
* Call this method and pass in <code>true</code> to enable video in the SIP call.
144+
* The default is <code>false</code>.
145+
*
146+
* @param video Whether video should be enabled in the SIP call.
147+
*
148+
* @return The SipProperties.Builder object with the SIP video setting.
149+
*/
150+
public Builder video(boolean video) {
151+
this.video = video;
152+
return this;
153+
}
154+
155+
/**
156+
* Call this method and pass in <code>true</code> to have the SIP end point observe
157+
* <a href="https://tokbox.com/developer/guides/moderation/#force_mute">force mute moderation</a>.
158+
* The default is <code>false</code>.
159+
*
160+
* @param observeForceMute Whether to observe force mute moderation.
161+
*
162+
* @return The SipProperties.Builder object with the observeForceMute setting.
163+
*/
164+
public Builder observeForceMute(boolean observeForceMute) {
165+
this.observeForceMute = observeForceMute;
166+
return this;
167+
}
168+
131169
/**
132170
* Builds the SipProperties object.
133171
*
@@ -137,18 +175,21 @@ public SipProperties build() {
137175
return new SipProperties(this);
138176
}
139177
}
178+
140179
/**
141180
* Returns the SIP URI.
142181
*/
143182
public String sipUri() {
144183
return sipUri;
145184
}
185+
146186
/**
147187
* Returns the from value.
148188
*/
149189
public String from() {
150190
return from;
151191
}
192+
152193
/**
153194
* Returns the user name.
154195
*/
@@ -169,10 +210,21 @@ public String password() {
169210
public String headersJsonStartingWithXDash() {
170211
return headersJsonStartingWithXDash;
171212
}
213+
172214
/**
173215
* Returns the secure value (<code>true</code> or <code>false</code>).
174216
*/
175217
public boolean secure() {
176218
return secure;
177219
}
220+
221+
/**
222+
* Return the video value (<code>true</code> or <code>false</code>).
223+
*/
224+
public boolean video() { return video; }
225+
226+
/**
227+
* Returns the observeForceMute value (<code>true</code> or <code>false</code>).
228+
*/
229+
public boolean observeForceMute() { return observeForceMute; }
178230
}

src/main/java/com/opentok/util/HttpClient.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,6 +737,12 @@ public String sipDial(String sessionId, String token, SipProperties props) throw
737737
jGenerator.writeFieldName("secure");
738738
jGenerator.writeBoolean(props.secure());
739739

740+
jGenerator.writeFieldName("video");
741+
jGenerator.writeBoolean(props.video());
742+
743+
jGenerator.writeFieldName("observeForceMute");
744+
jGenerator.writeBoolean(props.observeForceMute());
745+
740746
jGenerator.writeEndObject(); // end sip
741747
jGenerator.writeEndObject(); // end main object
742748
jGenerator.close();

0 commit comments

Comments
 (0)