2017-06-26 17 views
0

私が取り組んでいるプロジェクトでBing Speech Recognition APIを使用しようとしています。Bing Speech Recognition APIが408 "要求のタイムアウト(> 14000 ms)を返す"

私は、APIをテストするためにa small fileを作成しました:

$ file test5.wav 
test5.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 16000 Hz 
$ ls -lah test5.wav 
-rw-r--r-- 1 bauer 1049089 288K Jun 26 12:38 test5.wav 

私のアプリケーションですべてのエラーを排除するために、私はGet Started with Speech REST API in cURL articleからcurlコマンドを使用しています:

curl -v -X POST "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=de-DE" -H "Authorization: $ACCESS_TOKEN" -H 'Content-type: audio/wav; codec="audio/pcm"; samplerate=16000' --data-binary @test5.wav 

これは、応答私は得る:

Note: Unnecessary use of -X or --request, POST is already inferred. 
* timeout on name lookup is not supported 
* Trying 204.79.197.200... 
    % Total % Received % Xferd Average Speed Time Time  Time Current 
           Dload Upload Total Spent Left Speed 
    0  0 0  0 0  0  0  0 --:--:-- --:--:-- --:--:--  0* Connected to speech.platform.bing.com (204.79.197.200) port 443 (#0) 
* ALPN, offering http/1.1 
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH 
* successfully set certificate verify locations: 
* CAfile: C:/Users/bauer/AppData/Local/Programs/Git/mingw64/ssl/certs/ca-bundle.crt 
    CApath: none 
* TLSv1.2 (OUT), TLS header, Certificate Status (22): 
} [5 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Client hello (1): 
} [512 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server hello (2): 
{ [81 bytes data] 
* TLSv1.2 (IN), TLS handshake, Certificate (11): 
{ [4514 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server key exchange (12): 
{ [365 bytes data] 
* TLSv1.2 (IN), TLS handshake, Server finished (14): 
{ [4 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16): 
} [102 bytes data] 
* TLSv1.2 (OUT), TLS change cipher, Client hello (1): 
} [1 bytes data] 
* TLSv1.2 (OUT), TLS handshake, Finished (20): 
} [16 bytes data] 
* TLSv1.2 (IN), TLS change cipher, Client hello (1): 
{ [1 bytes data] 
* TLSv1.2 (IN), TLS handshake, Finished (20): 
{ [16 bytes data] 
* SSL connection using TLSv1.2/ECDHE-RSA-AES256-SHA384 
* ALPN, server did not agree to a protocol 
* Server certificate: 
*  subject: CN=www.bing.com 
*  start date: Nov 4 17:10:22 2016 GMT 
*  expire date: May 4 17:10:22 2018 GMT 
*  subjectAltName: speech.platform.bing.com matched 
*  issuer: C=US; ST=Washington; L=Redmond; O=Microsoft Corporation; OU=Microsoft IT; CN=Microsoft IT SSL SHA2 
*  SSL certificate verify ok. 
} [5 bytes data] 
> POST /speech/recognition/interactive/cognitiveservices/v1?language=de-DE HTTP/1.1 
> Host: speech.platform.bing.com 
> User-Agent: curl/7.47.1 
> Accept: */* 
> Authorization: *** 
> Content-type: audio/wav; codec="audio/pcm"; samplerate=44100 
> Content-Length: 294666 
> Expect: 100-continue 
> 
{ [5 bytes data] 
< HTTP/1.1 100 Continue 
} [5 bytes data] 
* We are completely uploaded and fine 
100 287k 0  0 100 287k  0 20521 0:00:14 0:00:14 --:--:--  0{ [5 bytes data] 
< HTTP/1.1 408 Request timed out (> 14000 ms) 
< Transfer-Encoding: chunked 
< Content-Type: text/plain 
< Server: Microsoft-IIS/10.0 
< X-MSEdge-Ref: Ref A: B46AA40C68BF4806B277B7D97D5CC386 Ref B: BER30EDGE0215 Ref C: Mon Jun 26 03:39:09 2017 PST 
< Date: Mon, 26 Jun 2017 10:39:08 GMT 
< 
{ [36 bytes data] 
100 287k 0 30 100 287k  2 20454 0:00:14 0:00:14 --:--:--  0Request timed out (> 14000 ms) 
* Connection #0 to host speech.platform.bing.com left intact 

なぜAPIコールは失敗するのですか?テストファイルに何か問題がありますか?必要なパラメータが不足していませんか?

答えて

0

代わりに、チャンク転送を強制してください。--header "Transfer-Encoding: chunked"を追加してください。したがって、完全なコマンドは:

curl -v -X POST "https://speech.platform.bing.com/speech/recognition/interactive/cognitiveservices/v1?language=de-DE" -H "Authorization: $ACCESS_TOKEN" -H 'Transfer-Encoding: chunked' -H 'Content-type: audio/wav; codec="audio/pcm"; samplerate=16000' --data-binary @test5.wav 
+0

ありがとう!エラーメッセージはここでは少しはっきりしているかもしれません。 –

関連する問題