Please do not enter the leading ":" or the trailing ":REPLY_FILE_NAME"
0)) {
$host="192.168.1.1"; # IP Address of the OpenSER (FIFO) Server
$port = 12345; # Port that OpenSER (FIFO) is listening on
$pos = strpos($cmd,"\n");
if ($pos == NULL) {
$fifo_cmd = ":$cmd:REPLY_FILE_NAME\n";
} else {
$t1 = substr($cmd,0,$pos-1);
$t2 = substr($cmd,$pos);
$fifo_cmd = ":$t1:REPLY_FILE_NAME$t2\n";
}
$timeout = 5;
$fp = fsockopen ($host, $port, $errno, $errstr, $timeout);
if (!$fp) {
die("Error opening socket: $errno $errstr");
} else {
echo " FIFO Command:
$fifo_cmd
";
// write the user string to the socket
fputs ($fp, $fifo_cmd);
// get the result
while ($result = fgets ($fp, 1024)) {
echo "Response: $result ";
}
// close the connection
fclose ($fp);
}
}
?>