Page 1 of 1

subdialog to do HTTP POST

Posted: Sat Feb 25, 2006 11:18 pm
by scooter6
I am developing an application that asks along the way for the
caller to speak their name after the beep -- then right after that they speak their address after the beep.

So - conceivably, I have 2 wav files now that the caller has recorded.

I have the full vxml dialog already done - is it possible to do a
<subdialog> or a <submit> to have the vxml POST these files to my
webserver and then continue on in this vxml root document or do I have to then dynamically create another vxml page for the call to continue?

Also - I have see the php examples to do file upload and I have gotten this to work with no problem. Is there an example of php code that anyone uses in order to POST multiple files at once?
Thanks

Scott

IVR example that posts 2 files from main page to a subdialog

Posted: Sun Feb 26, 2006 6:30 pm
by support
Hello,

Here is an IVR example that posts 2 files from a main page to a <subdialog>, this will allow you to save the files while still continuing on your normal execution path.

main.vxml:

Code: Select all

<vxml version="2.1">
<form>
  <record name="rec1" beep="true">
    <prompt bargein="false">Recording 1.  Start recording after the beep.</prompt>
  </record>
  <record name="rec2" beep="true">
    <prompt bargein="false">Recording 2.  Start recording after the beep.</prompt>
  </record>
  <subdialog src="subdialog.php" method="post" enctype="multipart/form-data" namelist="rec1 rec2">
    <filled>Files uploaded successfully</filled>
  </subdialog>
</form>
</vxml>
subdialog.php:

Code: Select all

<?php
move_uploaded_file($_FILES['rec1']['tmp_name'], "/tmp/recording1.raw");
move_uploaded_file($_FILES['rec2']['tmp_name'], "/tmp/recording2.raw");
echo("<?xml version=\"1.0\"?>");
?>
<vxml version="2.1">
<form>
  <block>
    <return/>
  </block>
</form>
</vxml>
The above IVR code does not make use of any IVR error handling or pass back status variables from the subdialog to the main page. Hope this helps.

Regards,
Plum Support