Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stepRepeatOnError TypeError: Cannot read property 'toLowerCase' of undefined at Promise #26

Open
salvedi opened this issue Jun 14, 2020 · 3 comments

Comments

@salvedi
Copy link

salvedi commented Jun 14, 2020

Добрый день!
voicer в связке с wit.ai . .. для настройки использовал эту статью https://voxlink.ru/kb/asterisk-configuration/golosovoj-nabor-v-asterisk-2/
До карантина все работало ... проблема где-то во время карантина возникла.
Если правильно понимаю, voicer сравнивает, но не выдает ответ ...
2020-6-11 22:30:56 - [32minfo [39m: 0000001 stepLookup
read file /etc/voicer/data/peernames.json
parsed [ { name: '333',
target: 'SIP/333',
variants: [ 'админ', 'иван валерьевич' ] } ]
2020-6-11 22:30:56 - [32minfo [39m: 0000001 stepRepeatOnError TypeError: Cannot read property 'toLowerCase' of undefined
at Promise (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:11:24)
at new Promise ()
at FileSource.find (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:10:12)
at fileReader.readFile.then.then.then (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:48:23)
at
Спасибо!

@antirek
Copy link
Owner

antirek commented Jun 15, 2020

немного выше в логе должна быть строка с тем, что вернул wit.ai
скорее всего он ничего не вернул, поэтому такая ошибка

в первую очередь я бы проверил валидность ключа wit.ai, а также в интерфейсе wit.ai распознаваемые варианты

@salvedi
Copy link
Author

salvedi commented Jun 15, 2020

Извиняюсь, что сократил лог ... тут 2 попытки, файл peernames.json создавал заново, для теста двух попыток.
в интерфейсе wit.ai, в логах, распознает верно две попытки https://prnt.sc/t09o0n
agi server started on port 3000 with config { agi: { port: 3000 },
processing:
{ totalAttempts: 2,
playGreeting: true,
playBeepBeforeRecording: false },
asterisk:
{ sounds:
{ onErrorBeforeFinish: 'ostavaytes',
onErrorBeforeRepeat: 'eseraz',
greeting: 'beep' },
recognitionDialplanVars: { status: 'RECOGNITION_RESULT', target: 'RECOGNITION_TARGET' } },
record: { directory: '/tmp', type: 'wav', duration: 3 },
recognize:
{ directory: '/tmp',
type: 'witai',
options: { developer_key: 'тут вроде как валидный ключ' } },
lookup:
{ type: 'file',
options: { dataFile: '/etc/voicer/data/peernames.json' } } }
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 -- start processing
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 variables {"agi_network":"yes","agi_request":"agi","agi_channel":"PJSIP/NeoGate_TA410_FXO_1-000000fe","agi_language":"ru","agi_type":"PJSIP","agi_uniqueid":"1591903841.1097","agi_version":"16.6.2","agi_callerid":"8916номер","agi_calleridname":"Иван Валерьевич","agi_callingpres":"0","agi_callingani2":"0","agi_callington":"0","agi_callingtns":"0","agi_dnid":"504","agi_rdnis":"unknown","agi_context":"my-voicer","agi_extension":"s","agi_priority":"1","agi_enhanced":"0.0","agi_accountcode":"","agi_threadid":"140276051379968","":""}
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 stepSetFailedVars
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 set RECOGNITION_RESULT=FAILED
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 stepGreeting
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 answer
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 o
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 stepRecord /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3
2020-6-11 22:30:51 - �[32minfo�[39m: 0000001 stepRecord start record
2020-6-11 22:30:54 - �[32minfo�[39m: 0000001 stepRecord end record
2020-6-11 22:30:54 - �[32minfo�[39m: 0000001 stepRecognize /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav
2020-6-11 22:30:54 - �[32minfo�[39m: 0000001 file /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav
options { developer_key: 'тут вроде как валидный ключ',
file: '/tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav' }
res Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]:
{ body:
PassThrough {
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: true,
_transformState: [Object] },
disturbed: false,
error: null },
[Symbol(Response internals)]:
{ url: 'https://api.wit.ai/speech',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object] },
counter: 0 } }
json { entities: {}, intents: [], text: 'админ', traits: {} }
2020-6-11 22:30:56 - �[32minfo�[39m: 0000001 text , intents=[], text=админ,
2020-6-11 22:30:56 - �[32minfo�[39m: 0000001 err Error: Parse: no result
at Promise (/usr/lib/node_modules/voicer/apps/agi/recognize/witaiParser.js:12:16)
at new Promise ()
at WitaiParser.parse (/usr/lib/node_modules/voicer/apps/agi/recognize/witaiParser.js:4:12)
at asrRequest.load.then (/usr/lib/node_modules/voicer/apps/agi/recognize/recognizer.js:19:30)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
2020-6-11 22:30:56 - �[32minfo�[39m: 0000001 stepLookup
read file /etc/voicer/data/peernames.json
parsed [ { name: '333',
target: 'SIP/333',
variants: [ 'админ', 'иван валерьевич' ] } ]
2020-6-11 22:30:56 - �[32minfo�[39m: 0000001 stepRepeatOnError TypeError: Cannot read property 'toLowerCase' of undefined
at Promise (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:11:24)
at new Promise ()
at FileSource.find (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:10:12)
at fileReader.readFile.then.then.then (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:48:23)
at
2020-6-11 22:30:58 - �[32minfo�[39m: 0000001 --- fail, make next attempt --- current=2, total=2
2020-6-11 22:30:58 - �[32minfo�[39m: 0000001 stepRecord /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3
2020-6-11 22:30:58 - �[32minfo�[39m: 0000001 stepRecord start record
2020-6-11 22:31:01 - �[32minfo�[39m: 0000001 stepRecord end record
2020-6-11 22:31:01 - �[32minfo�[39m: 0000001 stepRecognize /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav
2020-6-11 22:31:01 - �[32minfo�[39m: 0000001 file /tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav
options { developer_key: 'тут вроде как валидный ключ'',
file: '/tmp/2843df57-04e6-4717-82b4-f387a6eb77b3.wav' }
res Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]:
{ body:
PassThrough {
_readableState: [Object],
readable: true,
domain: null,
_events: [Object],
_eventsCount: 3,
_maxListeners: undefined,
_writableState: [Object],
writable: false,
allowHalfOpen: true,
_transformState: [Object] },
disturbed: false,
error: null },
[Symbol(Response internals)]:
{ url: 'https://api.wit.ai/speech',
status: 200,
statusText: 'OK',
headers: Headers { [Symbol(map)]: [Object] },
counter: 0 } }
json { entities: {}, intents: [], text: 'иван валерьевич', traits: {} }
2020-6-11 22:31:03 - �[32minfo�[39m: 0000001 text , intents=[], text=иван валерьевич,
2020-6-11 22:31:03 - �[32minfo�[39m: 0000001 err Error: Parse: no result
at Promise (/usr/lib/node_modules/voicer/apps/agi/recognize/witaiParser.js:12:16)
at new Promise ()
at WitaiParser.parse (/usr/lib/node_modules/voicer/apps/agi/recognize/witaiParser.js:4:12)
at asrRequest.load.then (/usr/lib/node_modules/voicer/apps/agi/recognize/recognizer.js:19:30)
at
at process._tickCallback (internal/process/next_tick.js:188:7)
2020-6-11 22:31:03 - �[32minfo�[39m: 0000001 stepLookup
read file /etc/voicer/data/peernames.json
parsed [ { name: '333',
target: 'SIP/333',
variants: [ 'админ', 'иван валерьевич' ] } ]
2020-6-11 22:31:03 - �[32minfo�[39m: 0000001 stepError TypeError: Cannot read property 'toLowerCase' of undefined
at Promise (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:11:24)
at new Promise ()
at FileSource.find (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:10:12)
at fileReader.readFile.then.then.then (/usr/lib/node_modules/voicer/apps/agi/source/fileSource.js:48:23)
at
2020-6-11 22:31:06 - �[32minfo�[39m: 0000001 stepFinish
2020-6-11 22:31:06 - �[32minfo�[39m: 0000001 -- hangup
2020-6-11 22:31:06 - �[32minfo�[39m: 0000001 stepFinish
2020-6-11 22:31:06 - �[32minfo�[39m: 0000001 -- close

antirek added a commit that referenced this issue Jun 15, 2020
@salvedi
Copy link
Author

salvedi commented Jun 17, 2020

npm install voicer -g
`npm WARN deprecated [email protected]: request has been deprecated, see request/request#3142
npm WARN deprecated [email protected]: Use uuid module instead
/usr/bin/voicer -> /usr/lib/node_modules/voicer/bin/agi.js
npm WARN notsup Unsupported engine for [email protected]: wanted: {"node":">=10"} (current: {"node":"8.11.3","npm":"6.14.5"})
npm WARN notsup Not compatible with your version of node/npm: [email protected]

все равно ошибка осталась ... не так обновляется, да?

ps Вручную исправил, спасибо, все работает!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants