working PHP script with socket
Hi, Outbound call went thru socket with the PHP program. The program as follows, <?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>"; $command = "api originate sofia/default/$Callee@<freeswitch IP address> $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); } } ?> Thanks -- Thank you with regards, Gopal,
participants (1)
-
Gopal krishnan