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

having problem with asterisk-speech-recognition some time it return results mostly empty #31

Closed tanveerhk closed 7 years ago

tanveerhk commented 8 years ago

below is my cli output. may be out of 20 tries it return one result other are blank. there is no error in the agi. please help

*CLI> == Using SIP RTP CoS mark 5 -- Executing [1234@custom:1] Answer("SIP/101-00000000", "") in new stack

0x2b03b000e300 -- Probation passed - setting RTP source address to 192.168.1.8:8306 -- Executing [1234@custom:2] NoOp("SIP/101-00000000", "(ulaw)") in new stack -- Executing [1234@custom:3] AGI("SIP/101-00000000", "speech-recog.agi,en-US") in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/speech-recog.agi -- speech-recog.agi: Clearing channel variables. -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Found speexenc in: /usr/local/bin/speexenc Use of uninitialized value in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 172, line 24. Use of uninitialized value in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 184, line 24. Use of uninitialized value in length at /var/lib/asterisk/agi-bin/speech-recog.agi line 189, 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)) -- <SIP/101-00000000> Playing 'beep.slin' (language 'en') -- speech-recog.agi: Command returned: 200 result=35 (dtmf) endpos=15200 -- speech-recog.agi: Recording Format: sln, Rate: 8000 Hz, Encoding format: speex -- speech-recog.agi: Languge: en-US, SSL: no, s=2, Interrupt keys: # -- speech-recog.agi: The response was: {"result":[]} Use of uninitialized value in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 290. -- speech-recog.agi: Setting variable: utterance = Use of uninitialized value in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 291. -- speech-recog.agi: Command returned: 200 result=1 Use of uninitialized value in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 290, line 28. -- speech-recog.agi: Setting variable: confidence = Use of uninitialized value in concatenation (.) or string at /var/lib/asterisk/agi-bin/speech-recog.agi line 291, line 28. -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Cleaning temp files. -- <SIP/101-00000000>AGI Script speech-recog.agi completed, returning 0 -- Executing [1234@custom:4] Verbose("SIP/101-00000000", "1,The text you just said is: ") in new stack The text you just said is: -- Executing [1234@custom:5] Verbose("SIP/101-00000000", "1,The probability to be right is: ") in new stack The probability to be right is: -- Executing [1234@custom:6] Hangup("SIP/101-00000000", "") in new stack == Spawn extension (custom, 1234, 6) exited non-zero on 'SIP/101-00000000'

zaf commented 8 years ago

Seems like you are using Speex to encode your sound data. This was experimental and i'm not sure if it is even properly supported by google anymore. Please switch to flac by setting $use_speex = 0; in the 'User defined parameters' section of the script. Also make sure you have an up to date version of it and enable SSL/TLS (recent versions have it enabled by default)

tanveerhk commented 8 years ago

Thanks Dear,

after you suggestion it improved but still have problem. some time it does not return anything please here ther the cli logs.

*CLI> == Using SIP RTP CoS mark 5 -- Executing [1234@custom:1] Answer("SIP/101-00000006", "") in new stack

0x2af6ac000e60 -- Probation passed - setting RTP source address to 192.168.1.8:8306 -- Executing [1234@custom:2] NoOp("SIP/101-00000006", "(ulaw)") in new stack -- Executing [1234@custom:3] AGI("SIP/101-00000006", "speech-recog.agi,en-US") in new stack -- Launched AGI Script /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi -- speech-recog.agi: Clearing channel variables. -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Found flac in: /usr/local/bin/flac Use of uninitialized value in length at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 172, line 24. Use of uninitialized value in length at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 184, line 24. Use of uninitialized value in length at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 189, 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)) -- <SIP/101-00000006> Playing 'beep.slin' (language 'en') -- speech-recog.agi: Command returned: 200 result=35 (dtmf) endpos=19360 -- speech-recog.agi: Recording Format: sln, Rate: 8000 Hz, Encoding format: flac -- speech-recog.agi: Languge: en-US, SSL: yes, s=2, Interrupt keys: # -- speech-recog.agi: The response was: {"result":[]} Use of uninitialized value in concatenation (.) or string at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 290. -- speech-recog.agi: Setting variable: utterance = Use of uninitialized value in concatenation (.) or string at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 291. -- speech-recog.agi: Command returned: 200 result=1 Use of uninitialized value in concatenation (.) or string at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 290, line 28. -- speech-recog.agi: Setting variable: confidence = Use of uninitialized value in concatenation (.) or string at /opt/asterisk/var/lib/asterisk/agi-bin/speech-recog.agi line 291, line 28. -- speech-recog.agi: Command returned: 200 result=1 -- speech-recog.agi: Cleaning temp files. -- <SIP/101-00000006>AGI Script speech-recog.agi completed, returning 0 -- Executing [1234@custom:4] Verbose("SIP/101-00000006", "1,The text you just said is: ") in new stack The text you just said is: -- Executing [1234@custom:5] Verbose("SIP/101-00000006", "1,The probability to be right is: ") in new stack The probability to be right is: -- Executing [1234@custom:6] Hangup("SIP/101-00000006", "") in new stack == Spawn extension (custom, 1234, 6) exited non-zero on 'SIP/101-00000006'


From: Lefteris Zafiris notifications@github.com Sent: Thursday, October 13, 2016 11:00:58 PM To: zaf/asterisk-speech-recog Cc: tanveerhk; Author Subject: Re: [zaf/asterisk-speech-recog] having problem with asterisk-speech-recognition some time it return results mostly empty (#31)

Seems like you are using Speex to encode your sound data. This was experimental and i'm not sure if it is even properly supported by google anymore. Please switch to flac by setting $use_speex = 0; in the 'User defined parameters' section of the script. Also make sure you have an up to date version of it and enable SSL/TLS (recent versions have it enabled by default)

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/zaf/asterisk-speech-recog/issues/31#issuecomment-253590181, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AVwyuQp1_3WMt-2M00Gzptq6Uip1O-NIks5qznHagaJpZM4KWCMi.

zaf commented 8 years ago

Seems like the API returns an empty JSON object. If its not a problem with your recording or with the API limits on the number of requests then only Google can answer why this fails.

dhawangupta commented 8 years ago

I guess Google Speech API is no longer working and newest addition is Google Cloud Speech API.