ftpCon:$ftpCon";
//echo "
localFile:$localFile";
//echo "
remoteFile:$remoteFile";
if(!@ftp_get($ftpCon,$localFile,$remoteFile,FTP_BINARY))
{
if($language == 'chn')
{
echo "
下载失败.
";
exit();
}
else
{
echo "
Get File Failed.
";
exit();
}
return(-1);
}
else
{
if($language == 'chn')
{
//echo "
下载成功.
";
}
else
{
//echo "
Successful.
";
}
}
}
return(1);
}
function PCMtoWAV($infile)
{
$fsize2 = filesize($infile);
$fsize1 = $fsize2+36;
$fsize2 = dechex($fsize2);
$fsize1 = dechex($fsize1);
$tmp = "";
$tmp = omc_keep_length($fsize2,"0","8");
$unitByte3 = substr($tmp,0,2);
$unitByte2 = substr($tmp,2,2);
$unitByte1 = substr($tmp,4,2);
$unitByte0 = substr($tmp,6,2);
$setfsize2 = $unitByte0.$unitByte1.$unitByte2.$unitByte3;
$tmp = "";
$tmp = omc_keep_length($fsize1,"0","8");
$unitByte3 = substr($tmp,0,2);
$unitByte2 = substr($tmp,2,2);
$unitByte1 = substr($tmp,4,2);
$unitByte0 = substr($tmp,6,2);
$setfsize1 = $unitByte0.$unitByte1.$unitByte2.$unitByte3;
$wavehead = "52494646".$setfsize1."57415645666d74201000000006000100401f0000401f00000200080064617461".$setfsize2;
$szwavehead = toAscii($wavehead);
$fp = fopen($infile, 'r+');
if(!$fp)
{
echo "open file fail.";
exit();
}
$contents = fread($fp, filesize($infile));
if(!$contents)
{
echo "read file fail.";
exit();
}
if(!rewind($fp))
{
echo "rewind file fail.";
exit();
}
if(!fwrite($fp, $szwavehead.$contents))
{
echo "write file fail.";
exit();
}
if(!fclose($fp))
{
echo "close file fail.";
exit();
}
}
echo "
| "; echo "Voice Play | ";
if(isset($backurl))
{
echo "";
echo "
|
| ";
//==========================================================
//数据处理
//==========================================================
//delete *.wav *.evr
$handle=opendir($localpath);
while($file=readdir($handle))
{
$retval="";
$pt=strrpos($file,".");
if($pt) $retval=substr($file,$pt+1,strlen($file)-$pt);
if($retval=='wav') unlink($localpath.$file);
if($retval=='evr') unlink($localpath.$file);
}
$sysIdArr = explode('_',$sysId);
$sysTypeNo = $sysIdArr[0];
$sysNo = $sysIdArr[1];
$subSysNo = $sysIdArr[2];
$getSysIdSql = "SELECT sysNo,subSysNo,ip FROM sysInfo
WHERE sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo'
";
// echo " getSysIdSql:$getSysIdSql"; $getSysIdResult= mysqli_query($pubConn,$getSysIdSql); $omcNum=mysqli_num_rows($getSysIdResult); if($omcNum <= 0) { if($language == 'chn') { echo "[错误]:系统列表中没有配置 OMC or VSS 的IP!"; exit(); } else { echo "Error:Can not find any OMC's or VSS's IP in system list,Please ADD it!"; exit(); } if($default !=1) { delImpFile(); } exit(); } $getSysIdRow=mysqli_fetch_array($getSysIdResult); $dstSeverIp = $getSysIdRow[ip]; flush(); $ftpCon=@ftp_connect($dstSeverIp); if($ftpCon < 1) { if($language == 'chn') { echo " 连接 $dstSeverIp 失败!"; exit(); } else { echo " Connect $dstSeverIp Failed!"; exit(); } continue; } else { flush(); } if(!@ftp_login($ftpCon,$ftpLoginName,$ftpLoginPwd)) { if($language == 'chn') { echo " 登陆 $sysName 失败!"; exit(); } else { echo " Login $sysName Failed!"; exit(); } @ftp_quit($ftpCon); continue; } else { flush(); } getFile($ftpCon); ftp_quit($ftpCon); flush(); //$result = exec("mv {$impFileArr[0][localFile]} $output"); $tmpSql = "SELECT detailStat FROM sysStat WHERE sysTypeNo='$sysTypeNo' AND sysNo='$sysNo' AND subSysNo='$subSysNo' "; $tmpResult= mysqli_query($pubConn,$tmpSql); $tmpRows=mysqli_num_rows($tmpResult); $voiceRule=bindec(getBitValue($tmpRows[detailStat],'68.3-68.3')); if($voiceRule==1)//MU LAW PCMtoWAV($impFileArr[0][localFile]); ?> |