dharm_rnd_autodial.php

来自「FIle to make auto calls and broadcast th」· PHP 代码 · 共 94 行

PHP
94
字号
<?  

 include ("dbConnection.php");


 $query =("SELECT name,date,amount,phno FROM tts1");
 $result=mysql_query($query);

   while($row = mysql_fetch_array($result)) 
   {

//echo"<br>------------------------Text file => wave file => gsm file creation-------------------------------------<br><br><br>";

  $dir="/var/www/html/dharmesh/pstplOBD/"; echo"<br>";
echo  $textfilename= "$row[3].txt";  echo"<br>";
  $textfile=$dir.$textfilename;  echo"<br>";

  $cf2 = fopen($textfile,"w+");
  fwrite($cf2,"Hello Mr. $row[0] . Day is $row[1]  and your  Amount is  $row[2] .\n");
  fclose($cf2);
  echo file_get_contents($textfile);
echo  shell_exec("/usr/bin/text2wave -eval '(voice_rab_diphone)' -o ".$dir."$row[3].wav ".$textfile); 
echo "<br> --in  between wave and gsm --- <br> ";
  shell_exec("/usr/bin/sox ".$dir."$row[3].wav -r 8000 -c 1 ".$dir."$row[3].gsm"); 
  unlink($dir."$row[3].wav"); 
  unlink($textfile);  
// shell_exec("cd /var/lib/asterisk/sounds/");
  shell_exec("/usr/bin/sudo /bin/cp ".$dir."$row[3].gsm  /var/lib/asterisk/sounds/");
 
 
       
echo"<br><br><br>---------------------------------  Call file creation  ----------------------------------------------------<br><br><br>";

//  $username="Dharmesh<br>";
 $callfilename= "$row[0].call"; 
echo $callfile=$dir.$callfilename; 
   $cf = fopen($callfile,"w+");
  fwrite($cf,"Channel: Zap/g1/$row[3]\n");
  fwrite($cf,"Context: outboundmsg\n");
  fwrite($cf,"Extension: $row[0]\n");
//  fwrite($cf,"Username: $username\n");
//  fwrite($cf,"Message: $row[3].gsm\n");
  fwrite($cf,"Priority: 1\n");
  fwrite($cf,"MaxRetries: 3\n");
  fwrite($cf,"RetryTime: 10\n");
  fwrite($cf,"WaitTime: 600\n");
  fclose($cf);

 echo shell_exec("/usr/bin/sudo /bin/cp $callfile /var/spool/asterisk/outgoing/");

echo"<br><br><br>----------------------------------  dial plan creation  ------------------------------------------------------<br><br>"; 



									     
 $dialplan = "exten => $row[0],1,Background($row[3])\n";
 echo $dir2 = "/etc/asterisk/custom_extensions.conf";
 echo  $cf1 = fopen($dir2,"a+");
  fwrite($cf1,$dialplan);
  //fclose($cf1);
//     system("ReScan");

echo"<br><br>-------------------------------------------THE  END---------------------------------------------<br>"; 


 system("/usr/sbin/asterisk -r"); 
 system("reload");
// shell_exec("exit");

my $option = $AGI->get_data('$phno', 15000, 1);
exit if $option == -1;

##### option 1 for admission Fees structure  
if ($option == 1)
 {
$query1 =("insert into obdreport(phno,name,date,response)values($phno,$name,$date,'1')");
 $result=mysql_query($query1);

 
$AGI->exec('Goto','10','1');
 }
 ##### option 2 for card and course material 
elsif ($option == 2)
 {
$AGI->exec('Goto','10','1');
 }



}



?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?