zaf / asterisk-speech-recog

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

API is reading but it wont recognize voice. Using cloud Speech #36

Closed Abe-Telo closed 6 years ago

Abe-Telo commented 7 years ago

I wounder what i am missing, any dependency? The API is defiantly reading. so whats going on here?

*CLI>  -- speech-recog.agi: Clearing channel variables.
 -- speech-recog.agi: Setting variable: utterance = -1
 -- speech-recog.agi: Command returned: 200 result=1
 -- speech-recog.agi: Setting variable: confidence = -1
 -- speech-recog.agi: Command returned: 200 result=1
 -- speech-recog.agi: Found flac in: /usr/bin/flac
Use of uninitialized value $AGI{"arg_2"} in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 135, <STDIN> line 24.
Use of uninitialized value $AGI{"arg_3"} in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 147, <STDIN> line 24.
Use of uninitialized value $AGI{"arg_4"} in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 152, <STDIN> line 24.
 -- speech-recog.agi: Checking channel status.
 -- speech-recog.agi: Command returned: 200 result=6
 -- speech-recog.agi: Command returned: 200 result=1 ((ulaw)) 
*CLI>     -- <SIP/-00000009> Playing 'beep.ulaw' (language 'en') 
*CLI>  -- speech-recog.agi: Command returned: 200 result=99983 (timeout) endpos=8160
 -- speech-recog.agi: Recording Format: sln, Rate: 8000 Hz, Language: en-US, s=5, Interrupt keys: #
 -- speech-recog.agi: The response was: 
Use of uninitialized value $response{"utterance"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 244.
 -- speech-recog.agi: Setting variable: utterance =
Use of uninitialized value $response{"utterance"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 245.
 -- speech-recog.agi: Command returned: 200 result=1
Use of uninitialized value $response{"confidence"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 244, <STDIN> line 28.
 -- speech-recog.agi: Setting variable: confidence =
Use of uninitialized value $response{"confidence"} in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 245, <STDIN> line 28.
 -- speech-recog.agi: Command returned: 200 result=1
 -- speech-recog.agi: Cleaning temp files.
    -- <SIP/-00000009>AGI Script speech-recog.agi completed, returning 0
    -- Executing [123412@mycontext:4] Verbose("SIP/-00000009", "1,Script returned:  , ") in new stack
 Script returned:  ,
    -- Executing [123412@mycontext:5] GotoIf("SIP/-00000009", "0?playback:retry") in new stack
    -- Goto (mycontext,123412,9) 

When i did a curl https://speech.googleapis.com/v1beta1/speech:syncrecognize?key=XXXXXXX -X POST -d '{helo}' I got

{ 
 "error": {
    "code": 400,
    "message": "Invalid JSON payload received. Unknown name \"{helo}\": Cannot bind query parameter. Field '{helo}' could not be found in request message.",
    "status": "INVALID_ARGUMENT",
    "details": [ {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [  {
            "description": "Invalid JSON payload received. Unknown name \"{helo}\": Cannot bind query parameter. Field '{helo}' could not be found in request message."
          } ] } ] }}
[root@localhost Speex-with-header-bytes-master]# curl https://speech.googleapis.com/v1beta1/speech:syncrecognize?key=AIzaSyDGHsR7Vmd6xNwsAoQrjH2XAbyjmLZ_DFU -X POST -d '{helo}'
PaulJeyasinghph commented 6 years ago

I have the same issue, where you able to fix this? My API is reading and come up with <SIP/2018-000051cd>AGI Script speech-recog.agi completed, returning 0 But it wont let me to talk, it just says -1

Thanks very much for your assistance.

PaulJeyasinghph commented 6 years ago

Here is the full output of AGI debug. Asterisk 13.17.1, Centos 7.3

-- Executing [2017@india:3] AGI("SIP/2018-000051cd", "speech-recog.agi,en-EN") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/speech-recog.agi <SIP/2018-000051cd>AGI Tx >> agi_request: speech-recog.agi <SIP/2018-000051cd>AGI Tx >> agi_channel: SIP/2018-000051cd <SIP/2018-000051cd>AGI Tx >> agi_language: en <SIP/2018-000051cd>AGI Tx >> agi_type: SIP <SIP/2018-000051cd>AGI Tx >> agi_uniqueid: 1527178246.147414 <SIP/2018-000051cd>AGI Tx >> agi_version: 13.17.1 <SIP/2018-000051cd>AGI Tx >> agi_callerid: 2018 <SIP/2018-000051cd>AGI Tx >> agi_calleridname: IT-Paul <SIP/2018-000051cd>AGI Tx >> agi_callingpres: 0 <SIP/2018-000051cd>AGI Tx >> agi_callingani2: 0 <SIP/2018-000051cd>AGI Tx >> agi_callington: 0 <SIP/2018-000051cd>AGI Tx >> agi_callingtns: 0 <SIP/2018-000051cd>AGI Tx >> agi_dnid: 2017 <SIP/2018-000051cd>AGI Tx >> agi_rdnis: unknown <SIP/2018-000051cd>AGI Tx >> agi_context: india <SIP/2018-000051cd>AGI Tx >> agi_extension: 2017 <SIP/2018-000051cd>AGI Tx >> agi_priority: 3 <SIP/2018-000051cd>AGI Tx >> agi_enhanced: 0.0 <SIP/2018-000051cd>AGI Tx >> agi_accountcode: 2018 <SIP/2018-000051cd>AGI Tx >> agi_threadid: 139844844660480 <SIP/2018-000051cd>AGI Tx >> agi_arg_1: en-EN <SIP/2018-000051cd>AGI Tx >> <SIP/2018-000051cd>AGI Rx << SET VARIABLE "utterance" "-1" <SIP/2018-000051cd>AGI Tx >> 200 result=1 <SIP/2018-000051cd>AGI Rx << SET VARIABLE "confidence" "-1" <SIP/2018-000051cd>AGI Tx >> 200 result=1 -- <SIP/2018-000051cd>AGI Script speech-recog.agi completed, returning 0