External script to call multiple extensions? Hook into IVR?

Hi,

I’ve read up a bit on generating calls from an external script - essentially generating an audio file and then placing a call file in the queue. The idea is a command-line script that takes an extension (or external number) and a string of text as arguments, passes the text through text-to-speech (flite) and then calls the specified extension and plays back the recording.

However, I have two questions about generating calls from a script (let’s be non-specific. It’s just a script that’s being run externally. For those who are interested, it will be called from Nagios monitoring to deliver alerts via VoIP).

  1. I need this script to generate a call to multiple extensions. Any ideas? I need two variants, A) one that calls all extensions and plays back the recording to everyone when they pickup (does not go to voicemail, but can tell if any of the extensions didn’t answer). B) calls all extensions, just plays message to the first one that picks up.

  2. Any thoughts on how to get a script-generated call to hook into an IVR that then returns data to the script? Should I just look into transferring the call to an existing AGI IVR script, or is there a better way? Essentially, I want the user to be prompted for a user ID and PIN, then allow the user to select from some pre-defined options and have the script act on them (probably using a socket connection to another server or updating a MySQL database).

The bottom line of what I need is a set of scripts that can call one or multiple extensions (internal or external via Zaptel/X-100P) and:

  1. Playback a message, passed as a string of text, to the first extn that answers. If nobody does, don’t go to voicemail, but returns whether someone answered and, if so, who it was.
  2. Playback a message to a list of extensions, playing back to every extension that answers, and return a list of who answered and who didn’t (to be acted upon after the calls).
  3. The above two, with the addition of an IVR that will ask for some information and then do something with it (something that asterisk can’t do, like communicating over an SSL’d socket with a remote server).

Thanks for any suggestions,
Jason

Anyone?

For a bit more detailed of a description…

I want to integrate Nagios monitoring with Asterisk (trixbox) so that it will call out if nobody has acknowledged an E-Mail alert within a set amount of time. Nagios can handle all of this, I just need to provide it with a command line to use as the notification. The advantage to using Asterisk is that if WAN connectivity is down, I can have the PBX call a cell phone or landline.

So, what I’d like is two types of notifications-

  1. Nagios runs a notification that calls the admins for the effected system, in order. The ones that don’t answer get nothing, The first one that does has the message played back. So I’d need the Asterisk script to know not to go to voicemail, and also to send a result back to Nagios so that it knows whether or not to place further calls.

  2. For really critical stuff, it calls everyone in a list and plays back the message to every line that picks up - preferable if it can do it all at once, but calling in list order would be OK. It should still return, for each number called, whether the person answered or not.

Now, to add some complexity, Nagios handles the concept of “acknowledging” alerts. I.e. if a problem is acknowledged, nobody else is called, and it’s marked as “being worked on”. I’d like a way to include an AGI where when the script calls someone, they can press 1 to acknowledge, and are prompted for a 4-digit passcode. The passcode and the digit 1, if entered, are passed back to Nagios to be dealt with.

Thanks for any suggestions,
Jason

What you are looking for can be done with callfiles. Callfiles can be generated with any external script or asterisk script and will be launched as soon as the call file is copied/moved into the /var/spoolasterisk/outgoing directory.

You can use a local channel in the callfile that points to context where you can do all the asterisk magic you have in mind. Dial several numbers at once and play a recording to everyone that pick up the phone or just have it played to the first one that picks up the phone or even fork a call I don’t think external scripts are needed to have this in place.

search for:
call files
local channels
forking calls

and I think you will find all the info needed