AWS Polly Integration

Can anybody help me with the AWS Polly TTS integration with asterisk, I am using festival however voice quality is not good.

Asterisk integration with an external TTS provider is one of the easiest thing on the world , as far as you can handle the TTS API, the goal is convert the text in a sound file with a format who asterisk , related to the Polly I suggest you use their documentation, polly API it is outside the scope of support on this forum

Thanks a lot…can you please suggest me any third party API

I have successfully implemented with Asterisk the following TTS

how was voice quality??

They have online demo, you can evaluate it your self

Can you share me the syntex of dialplan as well where you have used VoiceRSS api

same=>n,Set(__translated="Hello world")
same=>n,system(php /var/www/html/tts/voicerss1.php "${translated}" ${UNIQUEID} "${voicercode}")

php voicerss1.php code

//en-us fr-fr es-es es-mx
$message=rawurlencode($argv[1]); //convert spaces if not   wont work
$url=shell_exec(" curl -o /var/www/html/tts/$name.wav -G -d\"key=$api&hl=$lang&c=$type&f=$format&src=$message\"");
echo $url;


I gave you a working example you re free to modify it based on your needs, what you are doing wont work , you need to Write output to instead of stdout, if you re new with Asterisk I suggest start learning how Asterisk curl command work and then you can move foward

Easy with Polly:

Sample project to demonstrate usage of the AWS SDK for Node.js:

cd /opt/
git clone
cd aws-nodejs-sample
npm install
npm install optimist
npm install child_process
vim script.js

// Load the SDK
var argv = require(‘optimist’).argv;
const AWS = require(‘aws-sdk’)
const Fs = require(‘fs’)
var child_process = require(‘child_process’);
// Create an Polly client
const Polly = new AWS.Polly({
accessKeyId: “accessKeyId here”,
secretAccessKey: “secretAccesKey here”,
signatureVersion: ‘v4’,
region: ‘us-east-1’


let params = {
‘Text’: argv.text,
// ‘Text’: ‘Tatiana’,
‘OutputFormat’: ‘mp3’,
‘SampleRate’: ‘8000’,
‘VoiceId’: ‘Vitoria’

Polly.synthesizeSpeech(params, (err, data) => {
if (err) {
} else if (data) {
if (data.AudioStream instanceof Buffer) {
Fs.writeFile(argv.mp3, data.AudioStream, function(err) {
if (err) {
return console.log(err)
console.log(“The file was saved!”)
var output = child_process.execSync('lame --decode ’ + argv.mp3 + ’ ’ + ‘-b 8000’ + ’ ’ + argv.wav + ‘.wav’);



i’m not quite comfortable with node.js…but i’m trying…even for ARI implementation…
Can you give further details about TTS Polly implementation…how do i call inside Asterisk?
And so on…