-
Notifications
You must be signed in to change notification settings - Fork 300
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
fix: transcriber settings precedence #518
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,15 +106,22 @@ private String getCustomTranscriptionServiceClass(String tenant) | |
REMOTE_TRANSCRIPTION_CONFIG_URL, | ||
null); | ||
|
||
if (remoteTranscriptionConfigUrl != null) | ||
if (remoteTranscriptionConfigUrl != null && tenant != null) | ||
{ | ||
String transcriberClass = null; | ||
String tsConfigUrl = remoteTranscriptionConfigUrl + "/" + tenant; | ||
if (logger.isDebugEnabled()) | ||
{ | ||
logger.debug("Retrieving transcriber from remote URL " + tsConfigUrl); | ||
} | ||
|
||
try | ||
{ | ||
URL url = new URL(remoteTranscriptionConfigUrl + "/" + tenant); | ||
URL url = new URL(tsConfigUrl); | ||
HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | ||
conn.setRequestMethod("GET"); | ||
conn.setRequestProperty("Content-Type", "application/json"); | ||
conn.setConnectTimeout(3000); | ||
int responseCode = conn.getResponseCode(); | ||
if (responseCode == 200) | ||
{ | ||
|
@@ -133,24 +140,36 @@ private String getCustomTranscriptionServiceClass(String tenant) | |
} | ||
JSONObject obj = new JSONObject(responseBody.toString()); | ||
transcriberClass = obj.getString("transcriber"); | ||
if (logger.isDebugEnabled()) | ||
{ | ||
logger.debug("Using " + transcriberClass + " as the transcriber class."); | ||
} | ||
logger.info("Using " + transcriberClass + " as the transcriber class."); | ||
conn.disconnect(); | ||
return transcriberClass; | ||
} | ||
else | ||
{ | ||
logger.warn("Could not retrieve transcriber from remote URL. Response code: " + responseCode); | ||
} | ||
conn.disconnect(); | ||
return transcriberClass; | ||
} | ||
catch (Exception ex) | ||
{ | ||
logger.error("Could not retrieve transcriber from remote URL." + ex); | ||
} | ||
} | ||
|
||
return JigasiBundleActivator.getConfigurationService() | ||
logger.info("Attempting to retrieve transcriber from local configuration."); | ||
String customTranscriptionServiceClass | ||
= JigasiBundleActivator.getConfigurationService() | ||
.getString( | ||
CUSTOM_TRANSCRIPTION_SERVICE_PROP, | ||
null); | ||
if (customTranscriptionServiceClass != null) | ||
{ | ||
logger.info("Using " + customTranscriptionServiceClass + " as the transcriber class."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe leave only the print if there is a tenant enabling non default transcription. |
||
} | ||
else | ||
{ | ||
logger.info("No custom transcriber class found, falling back to default."); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We do not need this log. |
||
} | ||
return customTranscriptionServiceClass; | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, is this duplicated with the print bellow.