solomax commented on a change in pull request #92:
URL: https://github.com/apache/openmeetings/pull/92#discussion_r427488188
##########
File path:
openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
##########
@@ -337,7 +337,10 @@ JSONArray getTurnServers(final boolean test) {
mac.init(new
SecretKeySpec(turnSecret.getBytes(), HMAC_SHA1_ALGORITHM));
StringBuilder user = new StringBuilder()
.append((test ? 60 :
turnTtl * 60) + System.currentTimeMillis() / 1000L);
- if (!Strings.isEmpty(turnUser)) {
+ final String uid = c.getUid();
+ if (uid != null &&
!Strings.isEmpty(uid)) {
Review comment:
this `null` check is redundant here `Strings.isEmpty` will check for null
##########
File path:
openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
##########
@@ -346,9 +349,19 @@ JSONArray getTurnServers(final boolean test) {
turn.put("username", turnUser)
.put("credential", turnSecret);
}
- final String fturnUrl = "turn:" + turnUrl;
- turn.put("url", fturnUrl); // old-school
- turn.put("urls", fturnUrl);
+
+ JSONArray urls = new JSONArray();
+ final String[] turnUrls = turnUrl.split(",");
+ for (int i = 0; i < turnUrls.length; i++) {
Review comment:
_cosmetics_: `for (String url : turnUrls) {` will be more readable
will this code work if `turnUrl` is empty?
##########
File path:
openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KurentoHandler.java
##########
@@ -346,9 +349,19 @@ JSONArray getTurnServers(final boolean test) {
turn.put("username", turnUser)
.put("credential", turnSecret);
}
- final String fturnUrl = "turn:" + turnUrl;
- turn.put("url", fturnUrl); // old-school
- turn.put("urls", fturnUrl);
+
+ JSONArray urls = new JSONArray();
+ final String[] turnUrls = turnUrl.split(",");
+ for (int i = 0; i < turnUrls.length; i++) {
+ final String url = turnUrls[i];
+ if (!url.startsWith("stun:") &&
!url.startsWith("stuns:") && !url.startsWith("turn:") &&
!url.startsWith("turns:")) {
+ urls.put("turn:" + url);
+ } else {
+ urls.put(url);
+ }
+ }
+ turn.put("urls", urls);
Review comment:
Are you sure it is safe to drop `turn.put("url", fturnUrl); //
old-school` ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]