zaf / asterisk-speech-recog

Speech recognition script for Asterisk that uses google's speech engine.
GNU General Public License v2.0
245 stars 131 forks source link

Unable to get recognition data #32

Closed gabrielBarbutti closed 7 years ago

gabrielBarbutti commented 7 years ago

I get the error "Unable to get recognition data" and the two variables are set to -1. I know that this means my connection to google was not sucessful, but I tested with this command (curl -X POST --data-binary @'/var/lib/asterisk/sounds/en/hello-world.wav' --header 'Content-Type: audio/l16; rate=8000;' 'https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=***') and the connection was sucessful. Here is my CLI output: imagem1

dhawangupta commented 7 years ago

Hi, were you able to make it work?? Is Google Speech API still available? I tried sending an HTTP POST request (https://www.google.com/speech-api/v2/recognize?output=json&lang=en-us&key=API-Key&client=chromium&maxresults=6&pfilter=2) via Postman and got an empty json: { "result": [] }

aidoskz commented 7 years ago

Hi @dhawangupta i think it is old style new style of Google Speech Api

POST /v1beta1/speech:syncrecognize?fields=results&key= HTTP/1.1 HOST: speech.googleapis.com content-type: application/json content-length: 37278

{ "config": { "encoding": "FLAC", "sampleRate": 8000, "languageCode": "ru-RU" }, "audio": { "content": "< base64encodedFile >" } }

More information : https://cloud.google.com/speech/reference/rest/

dhawangupta commented 7 years ago

Yes @aidoskz you are right. This is new Google Cloud Speech API which needs to enable billing in the Google Cloud Console too.

zaf commented 7 years ago

There is a version for the new cloud API, its under the 'cloud_api' branch. As far as I know both APIs work at the moment.

dhawangupta commented 7 years ago

Hi @zaf, but, the older API only returns { "result": [] }