Use this Transcribe & Comprehend connector for real time transcription and sentiment analysis of voice calls .
In order to get started, you need to have an AWS account, retrieve your AWS key and secret, and take note of your AWS services default region.
To find your Access Key and Secret Access Key:
- Log in to your AWS Management Console.
- Click on your user name at the top right of the page.
- Click on the Security Credentials link from the drop-down menu.
- Find the Access Credentials section, and copy the latest Access Key ID.
- Click on the Show link in the same row, and copy the Secret Access Key.
Vonage Voice API's Amazon Transcribe & Comprehend connector makes use of the WebSockets feature. When a call is established, your Vonage Voice API application makes a websocket connection to this connector and streams the audio in real time via the websocket.
The connector posts back in real time transcripts and optionally sentiment scores, via a webhook call back to your Vonage Voice API application.
See https://github.com/nexmo-se/transcribe-comprehend-client for a sample code on how an application using Vonage Voice API can use the connector for real time transcription and sentiment analysis of voice calls.
The parameter sensitivity allows the Voice API application to set the VAD (Voice Activity Detection) sensitivity from the most sensitive (value = 0) to the least sensitive (value = 3), this is an integer value.
You may select one of the following 4 types of deployments.
Copy the .env.example file over to a new file called .env:
cp .env.example .envEdit .env file,
set the 3 first parameters with their respective values retrieved from your AWS account,
set the PORT value where websockets connections will be established.
Launch the Transcribe & Comprehend connector as a Docker instance:
docker-compose upYour Docker container's public hostname and port will be used by your Vonage Voice API application as part of the websocket uri wss://<docker_host_name>:<proxy_port>, e.g. wss://myserver.mydomain.com:40000
To run your own instance locally you'll need an up-to-date version of Python 3.8 (we tested with version 3.8.5).
Copy the .env.example file over to a new file called .env:
cp .env.example .envEdit .env file,
set the 3 first parameters with their respective values retrieved from your AWS account,
set the PORT value where websockets connections will be established.
Install dependencies once:
pip install --upgrade -r requirements.txtLaunch the connector service:
python server.pyYour server's public hostname and port will be used by your Vonage Voice API application as part of the websocket uri wss://<serverhostname>:<port>, e.g. wss://abcdef123456.ngrok.io
If you do not yet have a local git repository, create one:
git init
git add .
git commit -am "initial"Deploy this connector application to Heroku from the command line using the Heroku CLI:
heroku create myappnameOn your Heroku dashboard where your connector application page is shown, click on Settings button,
add the following Config Vars and set them with their respective values retrieved from your AWS account:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
git push heroku masterOn your Heroku dashboard where your connector application page is shown, click on Open App button, that URL will be the one to be used by your Vonage Voice API application as part of the websocket uri, e.g. wss://myappname.herokuapp.com
Click the 'Deploy to Heroku' button at the top of this page, and follow the instructions to enter your Heroku application name and the 3 AWS parameter respective values retrieved from your AWS account.
Once deployed, on the Heroku dashboard where your connector application page is shown, click on Open App button, that URL will be the one to be used by your Vonage Voice API application as part of the websocket uri, e.g. wss://myappname.herokuapp.com.
This connector is a multi-threaded application that submits concurrent transcription requests to Amazon Transcribe in parallel.
With this reference code, one connected websocket corresponds to one concurrent transcription request. You may decide to update the code on your own to use queues and worker threads to serialize transcription requests from multiple connected websockets.
Make sure your voice application and connector application do not submit more than the maximum allowed (default = 5) concurrent transcription requests on your Amazon Transcribe account.
You may see more information on that subject here.