Asterisk + Email + Paging System?

I am the IT Administrator for a local fire district and we just moved over to VoIP so we’re still exploring a lot of ways that the new Asterisk system we installed can really benefit us and make our lives easier.

I’m trying to setup so that in our system, when an email is received from a monitored email account, we’ll say “dispatches@firecompany.com”, that I can create a script that will automagically, grab that email and it’s contents. Generate a text to speech temporary file, and read out key form fields from that email, then delete the email.

Now I know that Asterisk alone can’t do all of this. But what would you recommend using to get this going.

I was originally thinking of using a PHPAGI + DialPlan function to kick this all off but at this point, it seems that the extension can only be trigged by calling it directly. The email contains all the fields we need to use, so there has to be a way to get them down to the Asterisk system, trigger a paging group to be opened, read out loud, and then disconnect the paging group.

Opinions?

You can active the extension with the page app using a cron job and local channel

Yes, I now realize I can achieve it that way but I’m having difficulty figuring out how to approach monitoring an email address 24/7/365 and feeding that information into asterisk to create the page itself. We have a text-to-speech engine that will take care of reading the actual dispatch report.

But how can I get the information from point A to point B. That’s what I’m struggling with. I’m trying to do this solely with PHP and AGI, or at least as much as possible.

Use IMAP and make an script to monitor for new emails and email content and keep it running in a cron job

I already have such a script (to monitor the inbox). My problem is getting that data from the script down to asterisk, and initiating the actual page. How do I accomplish that specific action?

Assuming you re using php you can use phpagi class and the set_variable method

I didn’t think to do that but how do I initiate the call to the paging group? Can I use a simple call file? Like that’s where I’m drawing a blank. How do I actually get the audio out to the phones?

I’m trying to do it like this:

PHP Script (monitors imap address) > PHP-AGI > ** This is where I’m drawing a blank ** > TTS > Paging Group

Originate action to local channel , who call the page app

Would you mind providing an example maybe that I can work from?

I dont have any sample code now, but there are lot information on the Asterisk Wiki related to the topics I have mentioned