Jump to content

PHP voicexml help


st1ng81

Recommended Posts

I am recording user's voice using vxml and want to generate .wav file on the disk.I am using php for that.But there is  some error,and the file is not getting saved.please some1 help me.If the .wav is generated how can i link it to database?

<!---record.xml--->
<?xml version="1.0"?>
<vxml version="2.0">
    <form>
        <record beep="true" name="file" type="audio/x-wav" maxtime="5s"
        dtmfterm="true">
            <prompt>
              Say something. Press any key to stop recording.
            </prompt>
            <noinput>
              I can't heard you.
            </noinput>
            <filled>
                <prompt>
                    Your message <value expr="file" />
                </prompt>
<submit next="123.php" method="post" namelist="file" enctype="multipart/form-data" />
          </filled>
      </record>
  </form>
</vxml>    

 

//123.php
<?PHP
header('Cache-Control: no-cache');
error_reporting (0);
$filename = $_HTTP_POST_FILES["file"];

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";

echo "<vxml version=\"2.0\">";

echo "<form id=\"main\">";
echo "<block>";

if ($HTTP_POST_FILES) {
  foreach ($HTTP_POST_FILES as $key => $value) {
    foreach ($value as $Filename) {

      if (strpos($Filename, "WIN7")) { $ServerSide = $Filename; }
      if (strpos($Filename, ".wav"))  { $ClientSide = $Filename; }
    }  // for each statement

    $ClientSide = str_replace("\\\\", "/", $ClientSide);

    if (!copy($ClientSide, "c:\audio-storage\temp.wav")) {
      echo "Could not save filename: " . $ClientSide;
    } // if statement
    else {
      echo "Successfully saved filename: " . $ClientSide;
    }  // else statement

  }  // for each statement
} 

echo "</block>";
echo "</form>";
echo "</vxml>";
?>

Link to comment
https://forums.phpfreaks.com/topic/255397-php-voicexml-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.