Git Product home page Git Product logo

asterisk--aeap-speech-to-text's Introduction

Asterisk External Speech to Text application

This package contains an example Node.js program that uses the Asterisk External Application Protocol (AEAP) to facilitate external speech to text translation in Asterisk 18.12.0+ and 19.4.0+.

Description

Background

For a while now Asterisk has had to ability to translate speech to text via its Speech Recognition API. Historically though, creating a new speech recognition engine required writing a new Asterisk module, typically written in "C", that implemented the backend API. Now, with the advent of AEAP, the backend speech API is abstracted away and translation can be done externally in the programming language of one's choice.

Example Program

This program acts as a mediator between Asterisk and the Google speech provider. Creating a websocket server it listens for incoming client connections from Asterisk. Once a connection is established, and a successful negotiation takes place using AEAP for speech audio can then be sent from Asterisk to the application, which then forwards it to the Google speech provider. Upon a confidence speech to text result received from Google, the application sends the result to Asterisk via an AEAP message.

Speech recognition will continue until the client closes, or an error occurs.

Dependencies

Installation

Run npm install from the top of the source tree. This will install the required npm packages.

Usage

To start the websocket server on the default port (9099):

$ index.js

Or to have it listen on a different port:

$ index.js --port=<port number>

To stop the server press Ctrl-C

Example Asterisk Configuration:

Configure an AEAP client in aeap.conf:

[my-speech-to-text]
type=client
codecs=!all,ulaw
url=ws://127.0.0.1:9099
protocol=speech_to_text

This will configure a "speech engine" in Asterisk that connects to the external application. When the Asterisk Speech Recognition API is employed in dialplan using the above "engine", this configuration is activated and a websocket client attempts to connect to the given URL. Next, create an extension that utilizes the speech API dialplan functions, and on SpeechCreate give the client id specified in aeap.conf as the "engine" name. Example extensions.conf:

exten => 550,1,NoOp()
	same => n,Answer()
	same => n,SpeechCreate(my-speech-to-text)
	same => n,SpeechStart()
	same => n,SpeechBackground(hello-world)
	same => n,Verbose(0,${SPEECH_TEXT(0)})
	same => n,SpeechDestroy()
	same => n,Hangup()

If things are configured correctly, and the sample program found here is listening at the configured address/port then when a caller dials extension 550 the following should occur:

  1. Asterisk connects via websocket to the remote application.
  2. The caller hears "Hello World" played back.
  3. After hearing "Hello World" any spoken audio from the caller is forwarded to the remote application.
  4. Once the caller is done speaking their spoken text is printed on the Asterisk CLI.
  5. The Client disconnects from remote application
  6. The call is hung up.

Other References

asterisk--aeap-speech-to-text's People

Contributors

kharwell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.