using PHP to record a wav file on remote server
Posted: Wed Mar 09, 2005 3:36 pm
Hi everyone-
I know I saw at least one other posting that had a <record> or dynamic scripting question but it really didn't answer my question. It is pretty similar to any posting on plum related to using <record> and then being able to access the wav file and finally copy that wav file to a remote server, all using PHP and vxml. Can someone help me?
Here is the vxml file to record:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="myrecording" expr=""/>
<form id="record_audio">
<record name="aud" beep="true" type="audio/basic" dtmfterm="true"
maxtime="60s" finalsilence="2s">
<prompt>
After the beep, please record a message.
To cancel the recording and start over, press the star key.
</prompt>
<filled>
<if cond="aud$.termchar == '*'">
<clear/>
<reprompt/>
<else/>
<assign name="myrecording" expr="aud"/>
<goto next="#review_audio"/>
</if>
</filled>
<catch event="noinput nomatch">
Sorry, I didn't hear you.
<reprompt />
</catch>
</record>
</form>
<form id="review_audio">
<property name="inputmodes" value="dtmf"/>
<property name="interdigittimeout" value="1s"/>
<field name="myfield">
<!-- <grammar type="application/x-jsgf">1</grammar> -->
<prompt>
You recorded the following message
<value expr="myrecording"/>
To submit this recording, Press 1
Or press any other key to re-record your message
</prompt>
<filled>
Thank you. Please wait while your audio file is
submitted to the recording repository.
<submit next="http://dialogix.org/upload_vxml.php" method="post" namelist="myrecording"/>
<if cond="test.success">
<prompt>
File uploaded successfully.
</prompt>
<else/>
<prompt>
File upload failed.
</prompt>
</if>
</filled>
<noinput>
<reprompt/>
</noinput>
<nomatch>
<goto next="#record_audio"/>
</nomatch>
</field>
</form>
</vxml>
Note: Having trouble with <if cond="test.success">. It doesn't work. How to make it work? Thank you.
Here is the php script:
<?php
echo "<?xml=\"1.0\"?>";
foreach ($_FILES as $file ) {
move_uploaded_file($file['tmp_name'], "/tmp/$file[name].raw");
}
?>
<vxml version="2.0">
<form id="myform">
</form>
</vxml>
Note: How can access the wav file that was generated through plum where the sound file is stored? In short, what submit or icopy tag or any other tag do I use in php to get the wav files? Thank you very much.
I know I saw at least one other posting that had a <record> or dynamic scripting question but it really didn't answer my question. It is pretty similar to any posting on plum related to using <record> and then being able to access the wav file and finally copy that wav file to a remote server, all using PHP and vxml. Can someone help me?
Here is the vxml file to record:
<?xml version="1.0"?>
<vxml version="2.0" xmlns="http://www.w3.org/2001/vxml">
<var name="myrecording" expr=""/>
<form id="record_audio">
<record name="aud" beep="true" type="audio/basic" dtmfterm="true"
maxtime="60s" finalsilence="2s">
<prompt>
After the beep, please record a message.
To cancel the recording and start over, press the star key.
</prompt>
<filled>
<if cond="aud$.termchar == '*'">
<clear/>
<reprompt/>
<else/>
<assign name="myrecording" expr="aud"/>
<goto next="#review_audio"/>
</if>
</filled>
<catch event="noinput nomatch">
Sorry, I didn't hear you.
<reprompt />
</catch>
</record>
</form>
<form id="review_audio">
<property name="inputmodes" value="dtmf"/>
<property name="interdigittimeout" value="1s"/>
<field name="myfield">
<!-- <grammar type="application/x-jsgf">1</grammar> -->
<prompt>
You recorded the following message
<value expr="myrecording"/>
To submit this recording, Press 1
Or press any other key to re-record your message
</prompt>
<filled>
Thank you. Please wait while your audio file is
submitted to the recording repository.
<submit next="http://dialogix.org/upload_vxml.php" method="post" namelist="myrecording"/>
<if cond="test.success">
<prompt>
File uploaded successfully.
</prompt>
<else/>
<prompt>
File upload failed.
</prompt>
</if>
</filled>
<noinput>
<reprompt/>
</noinput>
<nomatch>
<goto next="#record_audio"/>
</nomatch>
</field>
</form>
</vxml>
Note: Having trouble with <if cond="test.success">. It doesn't work. How to make it work? Thank you.
Here is the php script:
<?php
echo "<?xml=\"1.0\"?>";
foreach ($_FILES as $file ) {
move_uploaded_file($file['tmp_name'], "/tmp/$file[name].raw");
}
?>
<vxml version="2.0">
<form id="myform">
</form>
</vxml>
Note: How can access the wav file that was generated through plum where the sound file is stored? In short, what submit or icopy tag or any other tag do I use in php to get the wav files? Thank you very much.