Voice Bot

Easy How-To: Build a Voicebot using Voicegain, RASA, and AWS Lambda

One of the previous blog posts described a Voice Bot built using Twilio, Voicegain, RASA, and AWS Lambda. Twilio was used for telephony (phone numbers, SIP Trunking, TwiML for call control) Voicegain provided the ASR/speech recognition, while AWS Lambda was coordinating the actions. The setup works but is involved. The need to pass the speech recognition results via S3 (as Lambda is stateless and does not have memory between function calls) may occasionally cause delays in requests and responses.

Simple Inbuilt CPaaS Option

Voicegain now integrates with Amazon Chime Voice Connector to offer a pay as you go SIP Trunking service directly from the Voicegain web console. You can also purchase phone numbers and receive inbound calls. Support for making outbound Speech IVR calls is in the works.

Of course, we continue to support developer that use Twilio and SignalWire using simple SIP INVITE - this blog describes how.  

How does it work ?

The Components
  • AWS Lambda function - a single Node.js function with an API Gateway trigger (simple HTTP API type).
  • Voicegain Telephony Bot API - the Telephony Bot API  works with web callbacks. For Twilio and SignalWire developers, it is similar to working with Twilio TwiML and SignalWire LaML respectively.
  • RASA - dialog logic is provided by RASA NLU Dialog server which is accessible over RestInput API.
The Steps

The sequence diagram is provided below. It is very simple. Basically, the sequence of operations is as follows:

  1. Call a phone number provided by Voicegain (powered by Amazon Chime Voice Connector)
  2. Voicegain Telephony Bot API makes call to a callback function on AWS Lambda.
  3. Lambda function sends "Hi" RASA and RASA responds with the initial dialog prompt
  4. Lambda function responds to Voicegain callback with the prompt received from RASA and tell Voicegain Speech-to-Text to capture callers response.
  5. Voicegain uses TTS to generate from the text of the RASA question an audio prompt and plays it over the telephone to the caller
  6. The Caller hears the prompt and says something in response
  7. Voicegain ASR transcribes the speech to text and makes a callback with the result of transcription to Lambda function
  8. Lambda function invokes RASA and passes to it the text of the response.
  9. RASA processes the answer and generates next question in the dialogue
  10. We continue next turn same as in step 4.

The sample code for the Lambda function (in python and node.js versions) is available on our github.

Take Voicegain for a test drive!

1. Click here for instructions to access our live demo site.

2. If you are building a cool voice app and you are looking to test our APIs, click hereto sign up for a developer account  and receive $50 in free credits

Voicegain: Voice AI Under Your Control

Voicegain: Build Voice AI apps with our Speech-to-Text and LLM-powered NLU APIs. Record & Transcribe meetings, contact center calls, videos, etc. Get LLM-powered Summary, Sentiment and more. Build Conversational Voice Bots that integrate with your On-prem or cloud CCaaS platform. Get started today.

See how Voicegain works — get a demo of Voicegain today.

Sign up for an app today
* No credit card required.


Interested in customizing the ASR or deploying Voicegain on your infrastructure?

Contact Us → 
Voicegain - Speech-to-Text
Under Your Control