Caller is <?php echo htmlspecialchars($_POST['Caller']); ?>.<br>
Callee is <?php echo htmlspecialchars($_POST['Callee']); ?>.<br>
<br>

<?php
$Caller = htmlspecialchars($_POST['Caller']);
$Callee = htmlspecialchars($_POST['Callee']);
echo "Php now!<br>";
echo "Caller is: $Caller<br>";
echo "Callee is: $Callee<br>";

$handle = fsockopen('127.0.0.1', '8021', $erno, $errstr, 30);
if (!$handle) {
 //if connection fails exit and tell us what went wrong.
 die("Connect failed with erno $erno and errstr $errstr\n");
}
else {
 //read the first line the smtp server gives us (usually the version string)
 //$responses = fgets($handle, 1024);
 $response= fread($handle, 1024);
 echo "connection opened, got response:<br> $response<br><br>";

 $authMessage = "auth ClueCon\r\n\r\n";
 fwrite($handle, "$authMessage");


 $response = fread($handle, 1024);
 echo "authMessage sent, got response:<br> $response<br>";

 //$recording = "sendevent channel_execute record_session $${base_dir}/recordings/${destination_number}_${caller_id_number}.wav";
 $command = "api originate sofia/default/$Callee@172.20.176.254 $Caller \r\n\r\n";

 echo "command is $command";
 fwrite($handle, $command);
 
 $response = fread($handle, 1024);
 echo "command sent, got response:<br> $response<br>";
 $response = fread($handle, 1024);
 echo "command sent, got response:<br> $response<br>";
 

 fclose($handle);
}
?>


