啟用 Watson 服務的使用者名稱和密碼型記號鑑別
為了減少所連接 Watson 服務的回應時間,您可以啟用記號鑑別,以取得並快取與各項服務的特定一組認證相關的記號。這在 1.0.0.5a 版及更新版本中,可藉由減少 LDAP 查閱頻率,來減少客戶的交談延遲。
如果對基本鑑別啟用記號鑑別,當使用特定的一組服務認證,進行第一次查閱時,會擷取記號。在第一次查閱之後,會使用包含用於基本鑑別的使用者名稱和密碼組合的金鑰來快取記號。後續只要使用同一組認證向該服務發出要求時,就會使用該記號來鑑別,而不使用使用者名稱和密碼。如果因記號逾時,導致服務要求失敗,將會擷取並快取新記號。如同鑑別用的記號中的說明,來自服務的記號會在一小時後到期。鑑別記號的快取會在 24 小時後到期,且只有在發出要求給服務時,才會重新整理。
避免麻煩:只要您在 Voice Gateway 動作中,變更其中一項服務的認證,就必須指定已在新認證中啟用記號鑑別。如果沒有這樣做,記號鑑別會回復成預設基本鑑別。
在多租戶 JSON 配置中配置記號鑑別
您可以在 JSON 配置檔中啟用記號鑑別,作法是將每一項服務配置成使用 tokenAuthEnabled、tokenServiceProviderUrl 和 tokenServiceUrl。下列 JSON 配置顯示如何針對特定租戶啟用記號鑑別。
附註:當啟用記號鑑別,且沒有在 conversation 物件中定義 tokenServiceUrl 屬性時,則會自動將 url 值用於 Watson Assistant API。您可以將 Watson Assistant 的 url 內容配置成 https://gateway.watsonplatform.net/conversation/api 或 https://gateway.watsonplatform.net/assistant/api。
{
"tenants": [{
"tenantURI": "2345556789",
"description": "Voice Gateway Demo US",
"whitelistFromUri" : "8765554321",
"putCallerOnHoldOnTransfer" : "false",
"conversation": {
"url": "https://gateway.watsonplatform.net/conversation/api",
"workspaceID": "a23de67h-e527-40d5-a867-5c0ce9e72d0d",
"password": "InWtiUpYhF1Z",
"username": "9h7f54cb-d9ed-46b3-8492-e9a9bf555021",
"tokenAuthEnabled": true
},
"stt": {
"credentials": {
"url": "https://stream.watsonplatform.net/speech-to-text/api",
"username": "9h7f54cb-f28f-4a64-91e1-a0657e1dd3f4",
"password": "IAB5jfxls0Zt",
"tokenAuthEnabled": true
},
"config": {
"model": "en-US_NarrowbandModel",
"profanity_filter": true,
"smart_formatting": true
},
"confidenceScoreThreshold": 0.2,
"echoSuppression": true,
"bargeInResume": true
},
"tts": {
"cacheTimeToLive": 336,
"credentials": {
"url": "https://stream.watsonplatform.net/text-to-speech/api",
"username": "9h7f54cb-8b0f-4766-8b15-eaa8f7c3fae7",
"password": "HcmzFp1kec1P",
"tokenAuthEnabled": true
},
"config": {
"voice": "en-US_MichaelVoice"
}
}
}]
}
附註:如果 IBM® Text to Speech 的記號鑑別失敗,請新增 tokenServiceUrl 至 credentials。
{
"tts": {
"cacheTimeToLive": 336,
"credentials": {
"url": "https://stream.watsonplatform.net/text-to-speech/api",
"username": "9h7f54cb-8b0f-4766-8b15-eaa8f7c3fae7",
"password": "HcmzFp1kec1P",
"tokenAuthEnabled": true,
"tokenServiceUrl": "https://stream.watsonplatform.net/text-to-speech/api"
}
}
}
在單租戶環境中配置記號鑑別
您可以在單租戶環境中啟用記號鑑別,作法是為每一個儲存器配置下列環境變數。
SIP Orchestrator:
environment:
- WATSON_CONVERSATION_TOKEN_AUTH_ENABLED=true
Media Relay
environment:
- WATSON_TTS_TOKEN_AUTH_ENABLED=true
- WATSON_STT_TOKEN_AUTH_ENABLED=true