We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Submitting recorded wav file

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jtmerch
Posts: 27
Joined: Thu Jul 27, 2006 3:05 pm

Submitting recorded wav file

Post by jtmerch »

Hello, I would like to record the wav file and submit it via email. I've looked at the recording sample and found it to be pretty self explanatory but could someone give me an idea of how I could send the file that's created via email? I'm using asp.net and I know that you guys do not "support" asp.net but if you could breakdown how I could use voicexml to record, save and possibly email the file that would be great.

Here's the sample that I'm using (your sample):

<?xml version="1.0"?>
<vxml version="2.0">
<var name="pin" expr="'myID'"/>
<form>
<record name="recording" beep="true" type="audio/basic">
<prompt bargein="false">
Please record your message after the beep.
</prompt>
<catch event="nomatch noinput">
<reprompt/>
</catch>
</record>

<!-- The subdialog takes a namelist "pin recording" -->
<!-- and returns success(bool), fileid, and fileurl -->
<subdialog name="test" src="http://audio.plumgroup.com/vxml/file_up ... dialog.php"
namelist="pin recording" method="post">
<filled>
<if cond="test.success">
<prompt>
File uploaded successfully.
The file ID is <value expr="test.fileid"/>.
Your message was <audio expr="test.fileurl"/>.
</prompt>
<else/>
<prompt>
File upload failed.
</prompt>
</if>
</filled>
</subdialog>
</form>
</vxml>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code to record a wav file and submit it via email

Post by support »

Hi,

Using the IVR example, the actual sending of the email would take place in file_upload_subdialog.php (or your ASP equivalent). This line:

<subdialog name="test" src="http://audio.plumgroup.com/vxml/file_up ... dialog.php"
namelist="pin recording" method="post">

sends two pieces of data via HTTP POST to file_upload_subdialog.php: 'pin' (string data) and 'recording' (binary audio data). Your ASP code would look for the uploaded binary audio and attach it to an email.

Below is a quick and dirty PHP example (with some pseudocode in spots):

file_upload_subdialog.php:

<?php

// check for POSTed string data

$pin = $_POST['pin'];

// check for uploaded binary file
// ASP file handling may be very different
if (isset($_FILES['recording']) && is_uploaded_file($_FILES['recording']['tmp_name'])) {
$data = file_get_contents($_FILES['recording']['tmp_name']);
}

// set up mail message and attachment
// found this with 45 seconds of Googling:
// http://www.aspheute.com/english/20000918.asp


}

?>

Post Reply