Coder Social home page Coder Social logo

macide213 / asterisk-eagi-google-speech-recognition Goto Github PK

View Code? Open in Web Editor NEW

This project forked from phsultan/asterisk-eagi-google-speech-recognition

0.0 1.0 0.0 15 KB

An example of how to use Asterisk EAGI along with Google Speech recognition to transcribe voice to text

Shell 100.00%

asterisk-eagi-google-speech-recognition's Introduction

Transcribe audio in Asterisk with Google Speech Recognition

This repository is an example of how to use Google Speech Recogntion in Asterisk to transcribe audio voice.

Tools that are used here :

  • Asterisk EAGI (Extended Asterisk Gateway Interface), in bash
  • Node.js Google Cloud Speech client

Set up your Google Cloud Speech account and Node.js client

  1. Select or create a Cloud Platform project.

    Go to the projects page

  2. Enable billing for your project.

    Enable billing

  3. Enable the Google Cloud Speech API API.

    Enable the API

  4. Set up authentication with a service account so you can access the API from your local workstation.

Note : in transcribeWithGoogle.eagi, we assume that the generated Service Account .JSON file is stored in /usr/local/node_programs/service_account_file.json

Install the client library

git clone https://github.com/googleapis/nodejs-speech.git
cd nodejs-speech
npm install --save @google-cloud/speech

Note : we assume that the nodejs-speech directory sits under /usr/local/node_programs/. Adjust to your configuration.

Set up Asterisk

Edit your extensions.conf according to the example given in this repository :

exten = 6500,1,verbose(1, "User ${CALLERID(num)} dialed extension 6500. Testing Google Speech Recognition")
 same = n,noop(CHANNEL(audioreadformat) : ${CHANNEL(audioreadformat)})
 same = n,answer
 same = n,execif($[ "${CHANNEL(audioreadformat)}" = "opus" ]?set(EAGI_AUDIO_FORMAT=slin48):noop(Won't set EAGI_AUDIO_FORMAT))
 ; Usage : eagi(transcribeWithGoogle.eagi,<language>,<timeout>)
 ; <language> : en-US, fr-FR, etc.
 ; <timeout>  : the time to record audio input, in seconds
 same = n,eagi(transcribeWithGoogle.eagi,fr-FR,2)
 same = n,noop(GOOGLE_TRANSCRIPTION_RESULT : ${GOOGLE_TRANSCRIPTION_RESULT})
 same = n,hangup()

Copy the transcribeWithGoogle.eagi of this repository to /var/lib/asterisk/agi-bin/transcribeWithGoogle.eagi.

Call extension 6500 and inspect your Asterisk CLI to get the transcription, the EAGI script assigns the resulting text to the GOOGLE_TRANSCRIPTION_RESULT variable.

asterisk-eagi-google-speech-recognition's People

Contributors

phsultan avatar

Watchers

 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.