We will have an example of IVR code up for you by the end of today (Tuesday, Aug 31st)
support
We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics
save records as wav file
sample IVR code still needed
Last edited by support on Thu Jan 14, 2010 3:37 pm, edited 1 time in total.
IVR code example
Hi Vlad:
Sorry it took so long to get this to you. In the following IVR example there are 2 files: The front end, which includes all the vxml to present to the caller, and the backend, which includes all of the php to save the file to a local directory:
Frontend.vxml:
file_upload.php
You'll have to change the global upload directory and make it writable by the webserver user, but those 2 changes should be all that's needed.
Hope This helps, again sorry it took so long!
Plum Support Team
Sorry it took so long to get this to you. In the following IVR example there are 2 files: The front end, which includes all the vxml to present to the caller, and the backend, which includes all of the php to save the file to a local directory:
Frontend.vxml:
Code: Select all
<?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="file_upload.php"
method="post"
enctype="multipart/form-data"
namelist="myrecording"/>
</filled>
<noinput>
<reprompt/>
</noinput>
<nomatch>
<goto next="#record_audio"/>
</nomatch>
</field>
</form>
</vxml>
file_upload.php
Code: Select all
<?php
// EXTRACT myrecording FROM POST VARIABLES
if (!isset($_FILES['myrecording'])) {
////////////////////////ERROR CONDITION
die("No file was uploaded.");
}
$myrecording = $_FILES['myrecording'];
$tmp_name = $myrecording['tmp_name'];
$size = $myrecording['size'];
$type = $myrecording['type'];
GLOBAL $upload_dir;
$upload_dir = "/usr/local/apache/htdocs/www.mysite.com/upload_folder/";
// GENERATE A FILE NAME
$targetname = $upload_dir . "myrecording.wav";
// PLOP FILE INTO PLACE WITH NEW FILE ID
if (move_uploaded_file($tmp_name, $targetname)==false) {
////////////////////////ERROR CONDITION
unlink($tmp_name);
die("Relocation of uploaded file failed.");
}
?>
Hope This helps, again sorry it took so long!
Plum Support Team
Last edited by support on Thu Jan 14, 2010 3:38 pm, edited 1 time in total.
ASPX Example for Uploading a Recording
Vlad,
Were you ever able to successfully upload an audio file with ASPX? I'm trying to do the same thing and haven't had much success. If you could share your source code (much like your original thread in this post) it would save me a MASSIVE amount of time. The Php example is useful... but not really.
Best,
Scott
Were you ever able to successfully upload an audio file with ASPX? I'm trying to do the same thing and haven't had much success. If you could share your source code (much like your original thread in this post) it would save me a MASSIVE amount of time. The Php example is useful... but not really.
Best,
Scott
Re: ASPX Example for Uploading a Recording
Turns out to be pretty simple. You can access the Request.Files property, which is an HttpFileCollection, and which returns instances of System.Web.HttpPostedFile - same as if you had used the ASP.NET file control on a form.sdstuder wrote:Vlad,
Were you ever able to successfully upload an audio file with ASPX? I'm trying to do the same thing and haven't had much success. If you could share your source code (much like your original thread in this post) it would save me a MASSIVE amount of time. The Php example is useful... but not really.
Best,
Scott
An example:
Code: Select all
if (Request.Files.Count > 0)
{
System.Web.HttpPostedFile UploadedFile = Request.Files[0];
UploadedFile.SaveAs(@"c:\inetpub\wwwroot\FileUpload\Sample.pdf");
}
Jared