Can this be done with Asterisk?

My goal is to have some pre-recorded messages (.gsm files) that say things like “Hello, I’m calling to remind you that you have a meeting with Jane Doe at 12:00 PM on Tuesday April 20, 2011”…etc

However, the name (Jane Doe), the time (12:00 PM), and the date (Tuesday April 20,2011), would all be variables in a php form or something.

So, maybe the .gsm would say “Hello, I’m calling to remind you that you have a meeting with ____ at ____ on ____.”

Is this possible?

Yes its possible, You can look about festival text2wave application in PHPAGI, but dont expect great quality from speech engine.

If yo want Quality in your TTS, look at loquendo.

definitely more than possible. we have been doing this for almost two years for similar applications as you describe. our experience is that Cepstral text to speech ( for these kinds or messages delivers very high quality [in several languages]

Thanks. Can someone point me in the right direction to explain how I’d accomplish this? A friend of mine told me I should write some AGI scripts. However, I’m new to Asterisk and don’t know how to configure extensions.conf…

I found really usefull work with PHPAGI Library ad take a look about AGI cmd.

any other helpful info other that PHPAGI?

This question can be answered numerous ways. There are 3 main ways to write asterisk applications (like the one you are saying), and all of the ways require you to do programming.

  1. Create a call file generator which initiates calls through Asterisk. Then develop a dial plan content which is used when the outbound calls are answered, and contains your message logic (like say blah blah blah then hang up).
  2. Create a program which uses the AMI to originate outbound calls, and then write a dial plan context to handle the call logic once the call is answered.
  3. Use either of the above methods, except instead of writing a dial plan context to handle the logic, write an AGI application to handle the logic.

If you want to go the call file route, you should read the call file page on for insight:

If you are going to write AMI code, then read this page:

And if you want to write AGI applications, read this page:

I’m assuming that you already know how to write Asterisk dial plan, but if not, read O’Reilly’s book “Asterisk: The Future of Telephony” as it is considered the ‘definitive guide’ to Asterisk.

I am trying to do the same thing as the OP

I have managed to write a ami script in php that sends the extension to call but how can I send the text as a variable from the php script to the dial plan?

I am using the Flite tts engine

This is the context I want to send the text variable from my php script

exten => s,n,Flite($text)

If you are using something like described here you can use the application SET so you can set a variable with some text and then just playback with flite.

Can you please explain how I can use this

Suppose that your call file is this:

SET:MSG=‘hello world’

Then in your extensions.conf you have your context test:
exten=> s,1,answer()

How can it be done in an ami script in php?