asterisk / aeap-speech-to-text

Asterisk external speech to text application
Apache License 2.0
42 stars 26 forks source link

Unable to reproduce the readme example #1

Closed vcidst closed 2 years ago

vcidst commented 2 years ago

Hi, I'm looking for options to stream asterisk audio to my STT engine and tried to reproduce the example in your readme but faced certain errors. Can you please give me pointers how should I debug and get more information about the cause of error?

    -- Executing [918046******@from-external:1] Goto("PJSIP/airtel-00000001", "zi-tts-demo,s,1") in new stack
    -- Goto (zi-tts-demo,s,1)
    -- Executing [s@zi-tts-demo:1] NoOp("PJSIP/airtel-00000001", "") in new stack
    -- Executing [s@zi-tts-demo:2] Answer("PJSIP/airtel-00000001", "") in new stack
    -- Executing [s@zi-tts-demo:3] Playback("PJSIP/airtel-00000001", "silence/1&hello-world") in new stack
    -- <PJSIP/airtel-00000001> Playing 'silence/1.gsm' (language 'en')
    -- <PJSIP/airtel-00000001> Playing 'hello-world.gsm' (language 'en')
    -- Executing [s@zi-tts-demo:4] SpeechCreate("PJSIP/airtel-00000001", "zi-tts-speech") in new stack
    -- Executing [s@zi-tts-demo:5] SpeechStart("PJSIP/airtel-00000001", "") in new stack
  == Spawn extension (zi-tts-demo, s, 5) exited non-zero on 'PJSIP/airtel-00000001'

I'm running the node application locally and exposed it with an ngrok tunnel ngrok http 9099,

❯ node index.js
Server on port '9099': started listening

I tested the websocket connection by trying to connect to ws://127.0.0.1:9099 ws://localhost:9099 or ws://<ngrok_url> and was able to make successful websocket connection.

On the asterisk server, my configuration files look like the following,

aeap.conf

[zi-tts-speech]
type=client
codecs=!all,ulaw
url=ws://348d-83-110-20-206.ngrok.io
protocol=speech_to_text

extensions.conf

[from-external]
exten => 918046******,1,Goto(zi-tts-demo,s,1)

[zi-tts-demo]
exten => s,1,NoOp()
  same => n,Answer()
  same => n,Playback(silence/1&hello-world)
  same => n,SpeechCreate(zi-tts-speech)
  same => n,SpeechStart()
  same => n,SpeechBackground(hello-world)
  same => n,Verbose(0,${SPEECH_TEXT(0)})
  same => n,SpeechDestroy()
GlennS83 commented 2 years ago

Hi, I'm currently working on a similar proof of concept and were are running into the same problem. We've run our node server on the same server that Asterisk is running. I've connected successfully to the node server using wscat but I see no incoming connection when using the example dialplan. When I make a call we can see that Asterisk executes the SpeechCreate() and SpeechStart() but after that, the call exits with non-zero. I've been looking for some more info online but since its new functionality I'm not having much luck :(

Any ideas on what I might be doing wrong?

jcolp commented 2 years ago

The Asterisk side code for this has yet to be reviewed, merged, and released. If you are using it with a release version then it will not work.

GlennS83 commented 2 years ago

The Asterisk side code for this has yet to be reviewed, merged, and released. If you are using it with a release version then it will not work.

Thanks for the quick reply. If I would like to try this new code out, what/which version should I download?

jcolp commented 2 years ago

The code is up for review at https://gerrit.asterisk.org/c/asterisk/+/17330 - you would need to download the patch and apply it to the Asterisk master branch.

digas commented 2 years ago

Almost the same as the guys before , i'm on branch 18.12.1 , Testing the example code , when try to run the 550 example i get :

-- Executing [550@local-users:4] SpeechCreate("PJSIP/1107-00000001", "my-speech-to-text") in new stack [May 30 15:25:35] ERROR[4534]: res_aeap/aeap.c:204 raise_msg_handler: AEAP (0x7f8960011010): Cannot read property 'streamingRecognize' of undefined

What is the streamingRecognize ?

And on the node side i get :

Server on port '9099': client connected message: {"request":"setup","version":"0.1.0","codecs":[{"name":"ulaw"}],"params":{},"id":"3f4c0927-102c-4109-b04e-91299fd87938"}

--UPDATE, i was using node 12.xx and i believe this was related to this , on 18.xx it runs without any problem , regarding the library .

kharwell commented 2 years ago

What is the streamingRecognize ?

It's part of the Google speech recognition API, but sounds like updating the node version fixed things.

kharwell commented 2 years ago

The Asterisk side code has been merged. As well, it has been released and is now available in Asterisk 18.12.0+ and 19.4.0+.

edhorton01 commented 7 months ago

I have been trying to get this demo to function but I have the same thing happening as reported above. SpeechStart exits with non zero. I am using Asterisk 18.14. and node version 20.10.0. The sample node app seems to function properly waiting for a connection. I have verified my Google credentials. I have a second system running Asterisk 20.4.0 and node 20.10.0 also. Same thing. Any suggestions would be greatly appreciated.