Mass voice call

I want to record my message(or use tts) and send it to few numbers at the same time.

what is the best method to go about this?

how can I pass a variable to a dial plan from a agi or ami script written in php?

  1. I needed that. I created a list of numbers in mysql and then wrote a php script that grabbed the list of numbers from mysql, connected to the AMI to make the call. You can also use call files.
  2. Have a look at phpagi ( You can use the get_variable function. For instance if you wanted to get the cid number you can use such a script.

#!/usr/bin/php-cgi -q

$agi = new AGI();
include ("phpagi2.14/phpagi.php"); //Make sure you have this file

$cid_num = ast_var('CALLERID(num)');
$agi->Verbose("CID Number is $cid_num");

//Methods to get Variables
//$calling_num = ast_var('calling_num');
function ast_var($my_var){
        global $agi;          
        $my_var = $agi->get_variable($my_var);
        $my_var = $my_var['data'];             
        return $my_var;

I dont want to use call files

This is what I have done up until now

Created webpage with 3 fields (callerid,number,message)
Once user submits this form it calls a ami script written in php which originates the call through a context in the dialplan
I am able to send the callerid and extension to the dial plan but I am not able to send the message to the dialplan so that Flite can convert it to audio and play it to the receiver

This is my php file which originates the call

<?php $number = $_POST['number']; $callerid = $_POST['callerid']; $message = $_POST['message']; $socket = fsockopen("","5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: admin\r\n"); fputs($socket, "Secret: password\r\n\r\n"); $wrets=fgets($socket,128); echo $wrets; fputs($socket, "Action: Originate\r\n"); fputs($socket, "Channel: SIP/$number\r\n"); fputs($socket, "Context: test123\r\n"); fputs($socket, "Priority: 1\r\n"); fputs($socket, "message: $message\r\n"); fputs($socket, "Callerid: $callerid\r\n\r\n"); $wrets=fgets($socket,128); echo $wrets; ?>

This is the context in my extension_custom.conf

[test123] exten => s,1,Flite($message) exten => s,n,hangup()

I would like to add the data to a mysql database and then originate the call but for now I think it is best to take it step by step

How can I pass the message variable to the diaplan?

or what is the best way of doing the above