Originate a call with text to speech message

I use the Asterisk-Manager package for NodeJs

and have a tape announcement as a text which must be translated via text to speech. When I try to call an outgoing phone number how can I setup the text to speech variable and the recipient?
An example would be

    ami.action({
        'action': 'originate',
        '??? phonenumber ???': '12345',
        '??? text to be spoken ???': 'Hello, this is a tape announcement'
      }, (err, res) => {
        if (err) {
            throw err;
        }

        console.log('everything was fine');
      });

Where are you getting stuck?

On the information provided the appropriate answer to the question is read https://wiki.asterisk.org/wiki/display/AST/ManagerAction_Originate

@david551 Currently I don’t know how to setup the command. I have a text as a string and want to call someone, how / where can I pass in the text and the Asterisk engine launches a text to speech message when calling?

You appear to want bespoke design, rather than peer support.

You can pass the text in a variable, in the application parameter, or in the extension.

I can’t remember if Asterisk has a text to speech API. There is no real need for one, as you can create a file then play that.

If using AMI Originate action you can pass the string as a channel variable, then using the Exten option trigger your tts engine from the dial plan using system() or shell() command + playback()

@david551 @ambiorixg12 I know that FreePbx is used for administration. As far as I know there is a TTS module for the Asterisk engine.

I don’t know if I understood you correctly. I could go for this code

ami.action({
    channel: `SIP/${phoneNumber}`,
    application: 'SendText',
    data: announcement
}, (err, res) => {
    if (err) {
      throw err;
    }

    console.log(res);
});

and the engine would manage the data property?

That will send text as text, not as speech. I don’t believe there is any speech synthesis API in Asterisk. I think you have to use third party tools to construct the file and then play that file out.

That is correct, there is nothing built in for text to speech.

There are some providers which allow you to build an IVR in Asterisk using VoiceXML

I just took some information from this site

These are all third party add ons. Many rely on EAGI to inject a raw audio stream.

Also, please note that VoIP.info is generally considered unmaintained, and out of date.

So currently I think it would be the best way to use a TTS tool (third party addon) because we only get strings to process => on demand. I think it would be bad to generate a audio file on demand, make a call and delete the file afterwards.

Are there any recommendations for TTS tools?

Many people would use Google, but there may be data protection issues with doing that.

Those on a zero budget would probably use Festival.

In many cases you can assemble messages from pre-recorded segments, which is how Asterisk handles its own messages, but you can’t do that for free text.

Hi… Could someone suggest me a Text-to-speech solution with better quality than Cepstral ?
I need a solution like Cepstral that allows me to produce wave files or voices from text without internet access. I’ve found Cepstral really simple to integrate in asterisk and I’m looking for something like that with better voice quality…
Thanks in advance.
Matteo