我在这里遵循选项#4:
https://github.com/Microsoft/BotFramework-WebChat/blob/speech/samples/speech/index.html
并使用了我的COGNITIVE_SPEECH_API_KEY。但是,即使代码似乎按照docs的预期传递到请求中的Authorization
标头,我也会继续禁止403。
以下是我从Chrome开发者工具中捕获的请求和响应:
请求
网址: wss://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?format = simple& language = en-US& Authorization = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..kK1bx_kWllytyDvdqSZlb0_HUwaLX -V6OGJGeJ3fI2k&安培; X-的ConnectionId = 9B408F2612DE4902A2D37EEACC8FB350
请求方法:GET
状态代码:403禁止
响应标头
内容 - 长度:0
日期:2017年5月28日星期日15:10:31 GMT
服务器:微软-IIS / 10.0
X-MSEdge-Ref :参考A:B1DBE1CCBEEA44A6B0213CB1CF8B8CA6参考B:DEN02EDGE0314参考C:太阳5月28日08:10:31太平洋标准时间
请求标头
接受编码:gzip,deflate,sdch,br
接受语言:EN-US,EN; Q = 0.8
缓存控制:无缓存
连接:升级
曲奇:_ = IFAV A = 422B5EB35D6227B47A899A55FFFFFFFF&安培; COUNT = 0&安培; SEEALL = 2及VRSN = 2; SRCHD = AF = NOFORM; SRCHUSR = DOB = 20160521; MSFPC = ID = a0c448564466a044a98c006abcccbaf0&安培; CS = 3及LV = 201608&安培; V = 1; _RwBf = S = 10安培;○= 0&安培; A = 422B5EB35D6227B47A899A55FFFFFFFF; MUID = 2350DC04198E61F62654DA0E1D8E6287; _U = 1Y4QobYDPj3fzheUKiZ5uMdlvmGHvPLxng61hD9XLEWEhcPAfnXyj4UgFgyOMlw6jiTZJaP9wfqB4D6B2UYIV7_jbXnm5WTRM0ycCG-1F5YbfcPhiTR4SdgSkfPadkYRd; WLID = qgIk0rgVNCI8HNV2Z4g8xFSkWTapYBjrDBYC04Zh / 6JNzAhx2KtSiq + zTmKuyODQY3 + IA3XDFhKybijk6ArfNlzdJ448JV1JBNO / mmbbcGQ =; ANON = A = 422B5EB35D6227B47A899A55FFFFFFFF急症= 13d0&安培; W = 1; NAP = V = 1.9&安培; E = 1376和C = GKfvIsAF38G7JJpiBtQFE1j-85HTsObRYo50Mrr-fkR1HpimpRoSRA&安培; W = 1; ULC = T = CCC1 | 4:3; SRCHHPGUSR = CW = 1329&安培; CH = 716&安培; DPR = 2及UTC = -360
主机:speech.platform.bing.com
来源:https://ignitiontestbotweb.azurewebsites.net
附注:无缓存
仲丁基的WebSocket-扩展:permessage-DEFLATE; client_max_window_bits
仲丁基WebSocket的密钥:+ OV + WOyiaN3VFOIYmX1t3w ==
仲丁基的WebSocket-版:13
升级:WebSocket的
User-Agent :Mozilla / 5.0(Macintosh; Intel Mac OS X 10_12_5)AppleWebKit / 537.36(KHTML,与Gecko一样)Chrome / 58.0.3029.110 Safari浏览器/ 537.36
bing Speech API似乎随机接受了这些电话。十分之一的连接尝试通过101 Switch Protocols状态代码完成。对于同样的要求。
请求网址:wss://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?format = detailed& language = en-US& Ocp-Apim-Subscription -Key = 0825dc93563445aca227aa125404c299&安培; X-的ConnectionId = 2679C505D3D742A5809D1F08A1934E08
请求方法:GET
状态代码:101切换协议
请求网址:wss://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?format = simple& language = en-US& Ocp-Apim-Subscription -Key = 0825dc93563445aca227aa125404c299&安培; X-的ConnectionId = 2A47A79398D941ACB3F67A9580B908E3
请求方法:GET
状态代码:403禁止
答案 0 :(得分:1)
正如评论中所讨论的,您尝试使用的密钥与Custom Speech Service API以及您尝试运行needs Bing Speech API密钥的示例相对应。 Bing Speech是提供语音到文本功能的服务。