Skip to content

Commit cfb8b6c

Browse files
authored
Merge pull request #8 from Watson-Personal-Assistant/Ari---Multi-tenant-Audio-gateway-is-not-working-for-new-Tenant-#514
added support for tenantID that is sent to audio gateway
2 parents 8a0bae6 + 00b8b86 commit cfb8b6c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

config/configure.properties.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ IAMAPIKey=
1111
# Choosing which skill set to use (Required parameter)
1212
skillset=
1313

14+
# tenant ID can be passed (Optional parameter for customers with just one tenant - Required parameter for customers that have more then one tenant linked on their IBM ID account)
15+
#tenantID=
16+
1417
# Client language specific preferences can be passed (Optional parameter with a default value: en-US)
1518
#language=en-US
1619

src/main/java/wa/client/Client.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ public class Client extends WebSocketListener implements ThreadManager, Runnable
9898
private Boolean watsonSsl = true;
9999

100100
private String userID = null;
101+
102+
private String tenantID = null;
101103

102104
private String watsonVoice = null;
103105

@@ -1071,7 +1073,9 @@ private void initialize(Properties props) {
10711073

10721074
String noSsl = props.getProperty("nossl", "false");
10731075
watsonSsl = noSsl.equalsIgnoreCase("false");
1074-
// the userId
1076+
tenantID = props.getProperty("tenantID");
1077+
if (tenantID == null)
1078+
tenantID="";
10751079
userID = props.getProperty("userID");
10761080
watsonVoice = props.getProperty("voice");
10771081
commandSocketPort = Integer.parseInt(props.getProperty("cmdSocketPort", "10010"));
@@ -1090,6 +1094,7 @@ private void initialize(Properties props) {
10901094
LOG.info("WATSON PORT (Optional): " + watsonPort);
10911095
LOG.info("SKILLSET: " + skillset);
10921096
LOG.info("WATSON IAM API Key: " + (null == iamApiKey ? "null" : "*****"));
1097+
LOG.info("TENANT ID (Optional): " + tenantID);
10931098
LOG.info("USER ID (Optional): " + userID);
10941099
LOG.info("Language (Optional): " + language);
10951100
LOG.info("Engine (Optional): " + engine);
@@ -1229,7 +1234,10 @@ private synchronized void connect() throws InterruptedException {
12291234
// Build request
12301235
String webSocketUrl = (watsonSsl ? "wss" : "ws") + "://" + watsonHost + (watsonPort == null ? "" : ":" + watsonPort) + "?skillset=" + skillset + "&userID=" + userID
12311236
+ "&language=" + language + "&engine=" + engine;
1232-
Request request = new Request.Builder().url(webSocketUrl).addHeader("Authorization", "Bearer " + iamAccessToken).build();
1237+
Request request = new Request.Builder().url(webSocketUrl)
1238+
.addHeader("Authorization", "Bearer " + iamAccessToken)
1239+
.addHeader("tenantid", tenantID)
1240+
.build();
12331241

12341242
// initialize the watch dog
12351243
Runnable cleanup = new CleanUp(this.audioInput, this.audioOutput, this.indicator);

0 commit comments

Comments
 (0)