| VoiceXML 2.1 Development Guide | Home | Frameset Home |
|
<?xml version="1.0" encoding="UTF-8"?>
<vxml version = "2.1">
<form id="Main">
<record name="rec" beep="true" dtmfterm="true" finalsilence="5s" maxtime="100s">
<!--Explanation:
name="rec" Our variable to reference for playback
beep="true" Talk after the beep.
dtmfterm="true" Pressing any DTMF ends recording
finalsilence="5s" They may forget to press that ending DTMF
maxtime="100s" You want a full hard drive of stories about Aunt Ruth?
-->
<prompt>
I'm busy right now, honey. How's your Aunt Ruth?
</prompt>
<filled>
<log expr="rec$.duration"/>
<log expr="rec$.termchar"/>
<log expr="rec$.size"/>
<!-- We all love to hear our own voices: -->
<prompt> your recording was <value expr="rec"/> </prompt>
<submit expr=example.php method="post" namelist="rec" enctype="multipart/form-data"/>
</filled>
</record>
</form>
</vxml>
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<form>
<property name="recordutterance" value="true"/>
<property name="incompletetimeout" value="4s"/>
<field name="flavors">
<prompt>
What is your favorite flavor of ice cream?
</prompt>
<grammar type="application/srgs+xml" src="flavor.grxml"/>
<nomatch>
<var name="rec" expr="application.lastresult$.recording"/>
<prompt>I have never heard of <value expr="rec"/> ice cream! I will make a note to try that.</prompt>
<log expr="application.lastresult$.duration"/>
<log expr="application.lastresult$.size"/>
<submit method="post" enctype="multipart/form-data" next="example.php" namelist="rec"/>
</nomatch>
</field>
</form>
</vxml>
<?xml version="1.0" encoding="UTF-8" ?>
<!-- declaring the 'xmlns:voxeo' attribute is required -->
<vxml version="2.1" xmlns="http://www.w3.org/2001/vxml"
xmlns:voxeo="http://community.voxeo.com/xmlns/vxml">
<form id="Main">
<field name="caller" type="digits?length=1">
<prompt>
Employees please press 1.<break/>
Managers please press 2.<break/>
</prompt>
<grammar xml:lang="en-US" root = "TOP" mode="dtmf">
<rule id="TOP" scope="public">
<one-of>
<item> 1 <tag> <![CDATA[ <caller "employee"> ]]> </tag> </item>
<item> 2 <tag> <![CDATA[ <caller "manager"> ]]> </tag> </item>
</one-of>
</rule>
</grammar>
<filled>
<if cond="caller=='employee'">
<!-- Record 10% of employee calls. -->
<voxeo:recordcall value="10" info="employee" />
<elseif cond="caller=='manager'"/>
<!-- Record 100% of manager calls. -->
<voxeo:recordcall value="100" info="manager" />
<else/>
<!-- We don't know who this is so record no calls. -->
<voxeo:recordcall value="0" info="unknown" />
</if>
<goto nextitem="restOfCall"/>
</filled>
</field>
<block name="restOfCall">
<prompt>
Please hold while we transfer you.
<!-- and so forth and so on... -->
</prompt>
<exit/>
</block>
</form>
</vxml>
<record> or recordutterance, we will store the file in a local temp directory, which will allow you to playback the message while still within the app. However, if you want to keep this recorded file for future use, you will have to move it somewhere before we exit from the application. The good news is, Voxeo has provided a number of sample scripts below in a variety of server-side flavors to let you in on the necessary syntax.
<system.web>
<httpRuntime maxRequestLength="9000000" executionTimeout="360"/>
</system.web>
<?xml version='1.0'?>
<vxml version="2.0">
<form id="main">
<record name="CallersMessage" beep="true" maxtime="60s" finalsilence="2500ms" type="audio/wav">
<prompt>
Please record your message after the beep. You may record a message up to sixty seconds long. To end recording,
press any key or simply quit speaking.
</prompt>
</record>
<field name="confirmMessage" type="boolean">
<prompt>
I heard you say <value expr="CallersMessage"/>. To save this message say yes. To discard it say no.
</prompt>
<filled>
<if cond="confirmMessage">
<goto nextitem="askName"/>
<else/>
<goto next="#main"/>
</if>
</filled>
</field>
<field name="askName">
<prompt>
are you Jim, Jackson, or Aaron?
</prompt>
<grammar type="text/gsl"> [ aaron jackson jim ] </grammar>
<filled>
<if cond="askName == 'jim' || askName == 'jackson' || askName == 'aaron'">
<submit expr="'RecordMessage.aspx?askName='+askName"
method="post" namelist="CallersMessage" enctype="multipart/form-data"/>
<else/>
<prompt>
sorry charlie, we will not submit your file.
</prompt>
</if>
</filled>
</field>
</form>
</vxml>
<%@ Page language="vb" ContentType="text/plain" debug="true" %><%
'Get the single file that we POST-ed to this script
Dim file As HttpPostedFile = Request.Files.Get(0)
'Now save the file
file.SaveAs(Server.MapPath(file.fileName))
%><?xml version='1.0'?>
<vxml version="2.0">
<form>
<block>
<prompt>
Thanks, <% =Request.Querystring("askName")%> Your message has been saved.
</prompt>
</block>
</form>
</vxml>
<?xml version='1.0'?>
<vxml version="2.0">
<form id="main">
<record name="CallersMessage" beep="true" maxtime="60s" finalsilence="2500ms" type="audio/wav">
<prompt>
Please record your message after the beep. You may record a message up to sixty seconds long. To end recording,
press any key or simply quit speaking.
</prompt>
</record>
<field name="confirmMessage" type="boolean">
<prompt>
I heard you say <value expr="CallersMessage"/>. To save this message say yes. To discard it say no.
</prompt>
<filled>
<if cond="confirmMessage">
<goto nextitem="askName"/>
<else/>
<goto next="#main"/>
</if>
</filled>
</field>
<field name="askName">
<prompt>
are you Jim, Jackson, or Aaron?
</prompt>
<grammar type="text/gsl"> [ aaron jackson jim ] </grammar>
<filled>
<if cond="askName == 'jim' || askName == 'jackson' || askName == 'aaron'">
<submit expr="'RecordMessage.asp?askName='+askName"
method="post" namelist="CallersMessage" enctype="multipart/form-data"/>
<else/>
<prompt>
sorry charlie, we will not submit your file.
</prompt>
</if>
</filled>
</field>
</form>
</vxml>
<!--#include file="upload.inc"-->
<%
byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
picture = UploadRequest.Item("CallersMessage").Item("Value")
Filename = DatePart ( "h" , Now ) & DatePart ( "m" , Now ) & DatePart ( "s" , Now ) & DatePart ( "m" , Now ) & DatePart ( "d" , Now ) & DatePart ( "yyyy" , Now ) & ".wav"
Set FileSystem = CreateObject ("Scripting.FileSystemObject" )
Set WaveFile = FileSystem.CreateTextFile ( Server.MapPath ( filename ) )
WaveFile.Write getString(picture)
WaveFile.Close
Set WaveFile = Nothing
Set FileSystem = Nothing
%><?xml version='1.0'?>
<vxml version="2.0">
<form>
<block>
<prompt>
Thanks, <% =Request.Querystring("askName")%> Your message has been saved.
</prompt>
</block>
</form>
</vxml>
<%
Dim Filename
Dim FileSystem
Dim WaveFile
Dim binRead
Dim byteCount
'Byte string to string conversion
Function getString(StringBin)
getString =""
For intCount = 1 to LenB(StringBin)
getString = getString & chr(AscB(MidB(StringBin,intCount,1)))
Next
End Function
'String to byte string conversion
Function getByteString(StringStr)
For i = 1 to Len(StringStr)
char = Mid(StringStr,i,1)
getByteString = getByteString & chrB(AscB(char))
Next
End Function
Sub BuildUploadRequest(RequestBin)
'Get the boundary
PosBeg = 1
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
boundaryPos = InstrB(1,RequestBin,boundary)
'Get all data inside the boundaries
Do until (boundaryPos=InstrB(RequestBin,boundary & getByteString("--")))
'Members variable of objects are put in a dictionary object
Dim UploadControl
Set UploadControl = CreateObject("Scripting.Dictionary")
'Get an object name
Pos = InstrB(BoundaryPos,RequestBin,_
getByteString("Content-Disposition"))
Pos = InstrB(Pos,RequestBin,getByteString("name="))
PosBeg = Pos+6
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
Name = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
PosFile=InstrB(BoundaryPos,RequestBin,getByteString("filename="))
PosBound = InstrB(PosEnd,RequestBin,boundary)
'Test if object is of file type
If PosFile<>0 AND (PosFile<PosBound) Then
'Get Filename, content-type and content of file
PosBeg = PosFile + 10
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(34)))
FileName = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
'Add filename to dictionary object
UploadControl.Add "FileName", FileName
Pos = InstrB(PosEnd,RequestBin,getByteString("Content-Type:"))
PosBeg = Pos+14
PosEnd = InstrB(PosBeg,RequestBin,getByteString(chr(13)))
'Add content-type to dictionary object
ContentType = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
UploadControl.Add "ContentType",ContentType
'Get content of object
PosBeg = PosEnd+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = MidB(RequestBin,PosBeg,PosEnd-PosBeg)
Else
'Get content of object
Pos = InstrB(Pos,RequestBin,getByteString(chr(13)))
PosBeg = Pos+4
PosEnd = InstrB(PosBeg,RequestBin,boundary)-2
Value = getString(MidB(RequestBin,PosBeg,PosEnd-PosBeg))
End If
'Add content to dictionary object
UploadControl.Add "Value" , Value
'Add dictionary object to main dictionary
UploadRequest.Add name, UploadControl
'Loop to next object
BoundaryPos=InstrB(BoundaryPos+LenB(boundary),RequestBin,boundary)
Loop
End Sub
%>
<?xml version='1.0'?>
<vxml version="2.0">
<cfheader name="Cache-Control" value= "no-cache">
<cfheader name="Expires" value="#Now()#">
<CFIF IsDefined("form.greeting")>
<CFFILE Action="upload"
filefield="form.greeting"
destination="#getdirectoryfrompath(getcurrenttemplatepath())#"
mode="777"
nameconflict="makeunique">
<form>
<block>
<prompt>
We have saved this audio file to the server.
<audio src="<CFOUTPUT>#serverfile#</CFOUTPUT>" />
Please call back to record again.
</prompt>
</block>
</form>
<CFELSE>
<form>
<record name="greeting" beep="true" maxtime="30s" finalsilence="4000ms" type="audio/wav">
<prompt>
At the tone, please say your greeting.
</prompt>
<noinput>
I didn't hear anything, please try again.
</noinput>
<nomatch>
Your greeting is <value expr="greeting"/>.
</nomatch>
</record>
<field name="confirm" type="boolean">
<prompt>
Your greeting is <value expr="greeting"/>.
To keep it, say yes. To discard it, say no.
</prompt>
<filled>
<if cond="confirm">
<submit next="RecUpload.cfm" method="post" namelist="greeting" enctype="multipart/form-data"/>
</if>
<clear/>
</filled>
</field>
</form>
</CFIF>
</vxml>
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.0">
<CFIF IsDefined("form.greeting")>
<CFFILE Action="upload"
filefield="form.greeting"
destination="#getdirectoryfrompath(getcurrenttemplatepath())#"
mode="777"
nameconflict="makeunique">
<CFMAIL TO="me@here.com"
FROM="you@there.com"
SUBJECT="WAV EMAIL TEST">
Attached is your saved wav file.
<CFMAILPARAM
FILE="#file.serverdirectory#\#file.serverfile#">
</CFMAIL>
<form>
<block>
<prompt>
Data recieved.Thanks for recording.
</prompt>
</block>
</form>
<CFELSE>
<form>
<record name="greeting" beep="true" maxtime="10s" finalsilence="4000ms" type="audio/wav">
<prompt>
At the tone, please say your greeting.
</prompt>
<noinput>
I didn't hear anything, please try again.
</noinput>
</record>
<field name="confirm" type="boolean">
<prompt>
Your greeting is <value expr="greeting"/>.
Our shadow var for duration is <value expr="greeting$.duration"/>,
for size is <value expr="greeting$.size"/>
and for term character is <value expr="greeting$.termchar"/>
</prompt>
<prompt>
To keep this message, say yes. To discard it, say no.
</prompt>
<filled>
<if cond="confirm">
<submit next="cfrecord.cfm" method="post" namelist="greeting" enctype="multipart/form-data"/>
</if>
<clear/>
</filled>
</field>
</form>
</CFIF>
</vxml>
<?PHP
header('Cache-Control: no-cache');
error_reporting (0);
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, "WINNT")) { $ServerSide = $Filename; }
if (strpos($Filename, ".wav")) { $ClientSide = $Filename; }
} // for each statement
$ServerSide = str_replace("\\\\", "/", $ServerSide);
if (!copy($ServerSide, "c:/audio-storage/temp.wav")) {
echo "Could not save filename: " . $ServerSide;
} // if statement
else {
echo "Successfully saved filename: " . $ServerSide;
} // else statement
} // for each statement
} // if statement
echo "</block>";
echo "</form>";
echo "</vxml>";
?>
| ANNOTATIONS: EXISTING POSTS |
riyer
|
|
| To record & store audio data, do I need to upgrade to professional evolution on voxeo? | |
MattHenry
|
|
|
Hello Riyer, I'm going to take a guess on where it is that you are coming from on this inquiry. Can I assume that you are asking about the ability to use a JSP/PHP/etc script hosted on the voxeo servers that will store audio data for you? Note that if you have a host that is JSP/ASP/etc-capable, then you should be able to run the code sample of your choice and store recorded audio without any cost at all. ~Matt |
|
riyer
|
|
| Thanks Matt. My host sits behind a firewall. I will dig around a little more to see how I can set this up -- | |
symphonyx
|
|
| Thanks Matt.
Greetings from Chile. Bye, |
|
symphonyx
|
|
| Here the problem solved using vxml+php.
When submit a record the post to php is : file://localhost/yourtempwavfolder/yourtempfile.wav Is necessary "cut" the "file://localhost/" to get the correct file path. record.vxml <?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="php/upload.php" method="post" namelist="file" enctype="multipart/form-data" /> </filled> </record> </form> </vxml> upload.php <? header('Cache-Control: no-cache'); include 'util.php'; $MAX_FILE_SIZE = 15000000; $folder = "/tmp/"; $logfile = "log.txt"; // Post variables $fname = $HTTP_POST_FILES['file']['name']; $ftype = $HTTP_POST_FILES['file']['type']; $fsize = $HTTP_POST_FILES['file']['size']; $ftmp = $HTTP_POST_FILES['file']['tmp_name']; //save log $handler=fopen($folder.$logfile,"w"); fwrite($handler,the_file_name($fname)); fclose($handler); if($fize > $MAX_FILE_SIZE){$error = 2;} if(file_exists($folder."m_".$fname)){$error = 3;} if(copy(the_file_name($fname),$ftmp."wav")) {$error = 0;} switch($error){ case'0': $mensaje="File saved Ok."; break; case'1': $mensaje="Incorrect Format."; break; case'2': $mensaje="File so Big."; break; case'3': $mensaje="File already exists."; break; } echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; echo "<vxml version=\"2.0\">"; echo "<form id=\"main\">"; echo "<block>"; echo $mensaje; echo "</block>"; echo "</form>"; echo "</vxml>"; ?> util.php <?php function the_file_name($file){ $j=0; $l=strlen($file); for ($k=0;$k<=$l;$k++){ if (substr($file,$k,1)=='/'){ $j++; if ($j==3){ return substr($file,$k); } } } return ""; } ?> Greetings from Chile. Luis |
|
fayyazkl
|
|
| Hi,
Can i record audio along with simultaneously playing a song to caller. If this is possible, please provide some directions to do so. Thanks, Fayyaz |
|
mikethompson
|
|
| Hi Fayyaz,
Unfortunately, this is not natively supported within VoiceXML. However, if you *really* want to achieve this functionality, you will want to use CallXML or CCXML. This way, you can create a conference and join in another CallXML leg which simply records. Then dial another seperate CallXML application (and join it into the conference) to do the audio streaming. I know it is a lot of work for something which sounds simple, but this is currently the best way to approach recording audio while streaming audio. If you want to get started with this, here are some helpful links: http://docs.voxeo.com/callxml/2.0/t_14cxml.htm?search=conference#anchor http://docs.voxeo.com/callxml/2.0/joinconference.htm?search=conference#anchor Best, Mike Thompson Voxeo Corporation |
|
danielvinson
|
|
| Hiya
The ASP example seems to work when hosted on the Voxeo server. However I assume the Cold Fusion, JSP and PHP examples require specific servers. Is this correct? Can you tell me the advantage of using CF, JSP or PHP over ASP? The CF 2 example allows the caller to send the recorded message. Is it possible to do this in XML or ASP? Thanks Daniel |
|
VoxeoTony
|
|
| Hi Daniel,
Your questions are covered in the posting at http://docs.voxeo.com/voicexml/2.0/intro_serverside.htm?search=server#anchor However, since ASP is native to the Windows server environment the ASP example would be able to work on the hosted platform. We hope this helps you along. Tony~ |
|
danielvinson
|
|
| Hi Tony
Thanks for the link. Understand a bit better now. But using the ASP code when hosted on the Voxeo server...is this dynamic? Sorry for repeating myself but is it possible to write the ASP code such that it will email the recorded message or is this only available in CF, JSP etc Thanks Daniel |
|
VoxeoTony
|
|
| Hello Daniel,
I'm glad you were able to get some insight to your questions. For your questions on ASP we do know that ASP as a language is very powerful. The example on the site is dynamic in the sense that it is not a static file being sent off to the application. I do know that ASP will be able to email when properly coded. While we do not have examples for this in the tutorial, doing a search for ASP email examples should prove useful. Please let us know if this information helps. Regards, Tony |
|
fayyazkl
|
|
|
Hi Mike and others! Thank you very much for such a prompt response and favor. I just needed some further info. If i use a conference call for achieving simultaneous playback and recording, is it possible that i be charged a single call? Actually, i am working on an application which once go into production will obviously be charged per call through your network. However, we don't want to double that cost by making two calls per customer. Could you suggest a way out or something?? Thanking in anticipation. Fayyaz Khan Lodhi |
|
MattHenry
|
|
|
Fayyaz, This is really dependent on the nature of the application you are running, the amount of traffic that you are willing to commit to, and several other factors. As this is really a question of pricing, I think it might be best to direct such inquiries to sales@voxeo.com. As each customer has their own specific needs, each customer contract is going to be a little bit different in terms of what is billed. Hope this helps, ~Matthew henry |
|
fayyazkl
|
|
| Hi Mike and others,
Further to my question above i.e. i want to play a song to the caller while recording his voice simultaneously, I have learned conferencing with CCXML. But problem i am facing is, Conference is created when we call separate numbers, they are picked up by different people and we join these legs. But here i have a single caller who calls my application, the application picks up, and records his voice. If i want to play him a song while doing this, how would i call him in the middle of his running call? May be i have missed a point or have not explained my needs to you clearly. Please advise. Fayyaz Khan Lodhi |
|
MattHenry
|
|
|
To be clear: You have an app outdial app that, upon pickup by only a single party, will play a .wav file, and record the caller input, is this correct? If this is the case, then I would think that using a code structure with block/audio would serve to address the first part of the equation, and the <voxeo:recordcall> element would allow you to record both sides of the call. Is this what you are looking for? The finer details aren't very clear to me, so please forgive me if this is off-topic. ~Matt |
|
fayyazkl
|
|
|
Dear Matt, You almost understood correctly but missed one part i guess so i will elborate once to be clear. A user calls my in bound application i.e. he has the number attached to my application and he makes a call through normal phone. Upon picking the call, the application starts playing a song to him. During this play back he starts singing as well. And i want to record ONLY HIS SINGING and not the song played by application. Moreover, these two things i need to take place at the same time. From what you suggested, if i play with block/audio and then use voxeo :recordcall, recording will start AFTER the song being played is completed i.e. the playing and recording wont occur in parallel. Whereas my needs are to get both the functionalities done in parallel. Hope i have clarified my query. Hoping for a solution.Thanks Fayyaz |
|
MattHenry
|
|
|
Hello Fayyaz, This might be a bit tricky. There aren't any provisions within the VXML specification for simultaneous recording and input, where we can block out one of the audio streams, (a half-duplex connection). You *might* be able to figure a way to do this via a CCXML wrapper that <joins> two seperate legs, (one full duplex, the other half-duplex), but then we have the problem of how to disambiguate the prerecorded audio, and the callers voice input into the recorded file that you wish to generate. Much as I hate to say it, I'm not seeing a really easy way around this, as this is somewhat outside the boundaries of what VoiceXML is really designed to do. Regards, ~Matthew henry |
|
kubeworks
|
|
| when i try the CF2 example i get an error. I tried changing the cfrecord.cfm to the same name as my file and it gives me server as internal error.
Is there really a seperate CF script to be able to successfully do this test on CF? |
|
jbassett
|
|
| Hello,
The tutorial is for the recording and email of a file and should work by itself. If you feel there is something wrong, feel free to log in to your account and open a support forum ticket and wwe will be glad to assist you. You can also use the "Support" tab in the Debugger window to email us the logs from a failed session. This will give us a much better base of information to troubleshoot with, ultimately shortening the time to resolution. Thanks Jesse Bassett Voxeo Support |
|
georgelai
|
|
| I have tried and tried the php post script, and your php example fails every time, with the message: Could not save filename: file-1188123569661.wav
I even tried to change the { $ClientSide = $Filename; } to { $ServerSide = $Filename; } because the code was recognizing only ".wav" but it still failed to save. What is going on? From putting in the php code: echo "<log expr=\"'".$Filename."'\" />"; I see the following: LOG: file-1188123569661.wav LOG: audio/x-wav LOG: /tmp/phplVRimF LOG: 0 LOG: 27134 Help, please! This is driving me crazy! |
|
MattHenry
|
|
|
George, To be clear, *which* PHP code are you using? Is it the PHP in our tutorial, or the code posted by username "symphonyx" on 5/10/2006 2:41 PM (EDT)? Note that we aren't habit of providing dynamic coding support, but if you can provide us with some indication as to what is failing, and how, perhaps I can lend a hand. ~Matt |
|
rastgoo
|
|
| Hi
I was looking at w3 And here is what I have saw in definition of record tag "Platform support for recognition of speech grammars during recording is optional." Essentially this is exactly what we need to do. according to specification if input phrase match local grammer we should be able to get the interpretation thourgh application.lastapplication.lastresult$ Her is the link to specification http://www.w3.org/TR/voicexml20/#dml2.3.6 Also some platform supports the same functionality through <field> tag and using shadow vaiables. Also consider that <record> tag can have a child tag of <grammar> so look like there has to be some recognition functionality available via record rag. Sincerely |
|
rastgoo
|
|
| I forgot to mentioned that all of my test have failed till now.
here is the sample code which I tried to use <?xml version="1.0"?> <vxml version="2.0" xmlns="http://www.w3.org/2001/vxml"> <form> <script> <![CDATA[ function dumpResults(){ var result = "something"; for ( var i = 0; i < application.lastresult$.length; i++ ){ result += "Utterance is "+application.lastresult$.utterance + "."; result += "Utterance is "+application.lastresult$.interpretation+ "."; } return result; } function dumpResults2(){ var result = application.lastresult$.length; return result; } ]]> </script> <record name = "digit"> <!--record name="digit"--> <grammar src="builtin:grammar/digits"/> <prompt bargein="true"> <audio src="/vxml/audio/FD4945.VOX" fetchhint="prefetch"/> </prompt> <noinput> <audio src="/vxml/audio/FD4943.VOX" fetchhint="prefetch"/> </noinput> <nomatch> <audio src="/vxml/audio/FD4945.VOX" fetchhint="prefetch"/> </nomatch> <filled> <log >++++++++++++++++++++++<value expr = "dumpResults()" /></log> <audio src="/vxml/audio/FD4941.VOX" fetchhint="prefetch"/> </filled> </record> <!--/record--> </form> </vxml> I appriciate any help on this regard. |
|
VoxeoDustin
|
|
| Hey Rastgoo,
You are correct. I have reproduced this behavior and it does not agree with the spec. I have opened an internal Engineering ticket to address this issue and it will be resolved in a future build of Prophecy. Cheers, Dustin |
|
fahdbaig
|
|
| Hi,
I was wondering if its possible to record the speech in say 2 seconds chunks as the caller speaks? In other words, as the speaker is speaking every 2 seconds his/her speech is recorded as a WAV file. I'll have another application that will be taking in these WAV files, as they are recorded, and process them. Can you guide me on how to do this. Thank you very much. Fahd |
|
VoxeoDustin
|
|
| Hey Fahd,
Unfortunately, the VoiceXML spec does not provision for the ability to split the audio files into 2 second pieces. This is something that would need to be handled with post processing on the server side. Let me know if we can be of further assistance. Thanks, Dustin |
|
bilal
|
|
| hi there,
I tried the .asp script and recorded the file. But i am not able to open the wave file generated as a result. It seems to be corrupt or not properly written. I wanted to know if it was only me or somebody else also has had this problem. Thanks. |
|
MattHenry
|
|
|
Hi there, This could be due to a poor FTP connection, or any other number of issues on the server-side. You might try specifying an FTP destination for webhosting on our servers to see if it makes a difference: ftp://[USERNAME]:[PASSWORD]@ftp-internal.voxeo.net Hope this helps, ~Matthew Henry |
|
dmchugh
|
|
| Does the 'submit' tag support Https?
<submit expr="'https://myserver.com/RecordMessage.asp?askName='+askName" method="post" namelist="CallersMessage" enctype="multipart/form-data"/> |
|
VoxeoBrian
|
|
| Hello,
Indeed, HTTPS/SSL is fully supported on the Voxeo Network provided the webserver is utilizing a cert found in our stock java keystore. For your reference, and if you are searching for a certificate vendor I am attaching our keystore to this ticket. Let me know if this helps. Thanks, Brian |
|
Magician
|
|
| Greetings & Salutations,
Much thanks for your help on this problem, as well as all the others submitted by myself and my voice magic friends. Within the ASP example, you have an ending piece of VXML code which I would like to eliminate. I have tried just losing the <prompt> and its contents. This seems to disconnect my call. When I try to eliminate the VXML entirely from within the ASP, it fails. Ideally, I would like to eliminate the piece after the <% %> header block and run the RecordMessage.asp blind. I believe that this piece is teminating my call. Your magic spells to cure this problem would be sincerely appreciated. Magician |
|
voxeoJeffK
|
|
| Hi,
The call will terminate if there is no VXML left to execute, so the ASP document outputs VXML back to the voice browser. Since the original VXML page uses <submit> to send the recording to the ASP page, that VXML document is done and gone. We need to have a new VXML document output back to the browser to continue with the call. Regards, Jeff K. |
|
ievolve
|
|
| The following code works pretty well. The only problem is when I want to let the user re-record their message. It sends them back to the top and prompts them to regord their message, but upon finishing their recording the app just crashes, I assume this can be done, anyone have any ideas?
<record name="recording" beep="true" maxtime="300s" finalsilence="3000ms" type="audio/wav"> <prompt bargein="false"> Record your message after the tone </prompt> <noinput> I didn't hear anything, please try again. </noinput> </record> <field name="confirm" type="digits?length=1"> <prompt> To listen to your message press 1.<break/> To record your message again press 2.<break/> To confirm and upload your message press 3.<break/> </prompt> <filled> <if cond="confirm==1"> <prompt> Your message is <value expr="recording"/>. </prompt> <goto nextitem="confirm"/> <elseif cond="confirm==3"/> <var name="MsgDuration" expr="recording$.duration"/> <prompt bargein="false"> Thank you, your message has been uploaded. </prompt> <submit next="app.cfm" method="post" namelist="recording ValidatedID CallerID MsgDuration" enctype="multipart/form-data"/> <elseif cond="confirm==2"/> <goto nextitem="recording"/> <else/> <prompt>Sorry, I didnt understand</prompt> </if> </filled> </field> |
|
ievolve
|
|
| Got it figured out, I had to clear stuff out right befre jumping back up to the record dialog <clear namelist="confirm"/> | |
voxeoAlexBring
|
|
| Hello,
Were glad to hear you have the code working now. Please let us know if you need assistance with any issues. Regards, Alex Bring Voxeo Support |
|
ouno
|
|
| I have a application.lastresult$.recording expression as illustrated below:
<property name="recordutterance" value="true"/> <nomatch> <var name="rec" expr="application.lastresult$.recording"/> <prompt>I have never heard of <value expr="rec"/> ice cream! I will make a note to try that.</prompt> </nomatch> The question is, that when the recording plays there is a lot of "whitespace" which amounts to 1-3 seconds of nothing, which I'm assuming is the time that a user was not talking but listening to the voice prompts. Is there a way to "cut" the whitespace out, and just hear the utterance? My <var name="rec" /> is in a <nomatch count="3" /> node. Does that matter? |
|
VoxeoDustin
|
|
| Hey,
The only way to disable the silence at the beginning of the recording is to disable barge-in for the prompts inside of the record block or to move all prompts outside the record block. With barge-in enabled, the recognizer will begin listening as soon as the prompt starts, hence the silence: <block> <prompt> Record your message after the beep </prompt> </block> <record dtmfterm="true" name="my_recording"> <nomatch> ... </nomatch> </record> or <record dtmfterm="true" name="my_recording"> <prompt bargein="false"> Record your message after the beep </prompt> .. Let me know if we can be of further assistance. Cheers, Dustin |
|
jalATfoneval
|
|
| Does anyone have a plane jane jsp servlet that stores a recorded post sent with enctype="multipart/form-data". The O'reilly stuff on the side looks awesome for a full scale deployment, but I am trying to figure out how this stuff all works at this point. Right now all of my stored record files are badley corrupted. | |
voxeo_chris
|
|
| Hello Jeffrey,
Regarding your question on the availability of a jsp servlet that stores a recording, I would highly recommend you check out a Java support site as they would be better suited to answer your question there. Also, if you wanted to simply just record the entire call, you could simply use the voxeo:recordcall element which will record the entire call and place it in your recordings folder. Please let us know if you have any other questions as we would be happy to help. Regards, Chris Bruckart Customer Engineer Voxeo Support |
|
akabani
|
|
| Is it possible to submit the audio content to an ASP.NET webservice (ASMX) using the <data> element? I don't want to use <submit> and generate new VXML code to transition the flow. | |
voxeojeremyr
|
|
| Hi,
Yes you can. Through the <data> element you can do a "fire and forget". You will make sure that you set the 'enctype' attribute to "multipart/form-data" when submitting the audio file. Here is the link to describe the <data> element in its entirety: http://www.vxml.org/data.htm Regards, Jeremy Richmond Voxeo Support |
|
akabani
|
|
| Are there any examples for ASP.NET web services that do this with the <record> and <data> element. I keep getting a Server Error 500. | |
voxeoblehn
|
|
| Hello,
What you will need to do is assign your recording to a document scoped variables and then use the <data> tag to POST the recording. An example would something like the following where your record variable is equal to RecordedAudio: [code] <data srcexpr="'http://mywebhost.com/SaveAudioFile.aspx?instanceId='+instanceId" method="post" namelist="RecordedAudio" enctype="multipart/form-data"/> [/code] Please note the use of enctype="multipart/form-data" as this is a necessity for this to work. Please let us know if you have any additional questions or concerns. Best Regards, Brian Lehnen Voxeo Support |
|
phoebus
|
|
| This is driving me crazy- if I try to pass recorded audio thru submit, I get error 500 (same as akabani)...
...following voxeoblehn's suggestion (data) the line hangs up (that usually happens after parse error). I stripped destination file to simple audio block: <?xml version="1.0" encoding="UTF-8"?> <vxml xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml http://www.w3.org/TR/voicexml20/vxml.xsd" xml:lang="en" version="2.0"> <meta name="maintainer" content="(not posting email- spam)" /> <form id="main"> <block> <audio src="menu.wav" /> </block> </form> </vxml> The code that calls is: (...) <record name="pff" beep="true" maxtime="10s" finalsilence="400ms" dtmfterm="true" type="audio/x-wav"> <filled> <audio expr="pff"/> <data name="file" src="test.vxml" namelist="pff" fetchhint="safe" fetchtimeout="1000" method="post" enctype="multipart/form-data" /> </filled> </record> (...) I tested "test.vxml" (renamed it to index.vxml and called) and it works OK. Any ideas? --edit-- after checking server's logs, the file "test.vxml" (destination) isn't fetched, so it doesn't like something about main document (data tag- after removing it, it works -but of course, it doesn't send anything) |
|
voxeoJeffK
|
|
| Hello,
I think the issue here is that you are trying to upload a recording file to a static VXML document. Uploading would require a destination of a dynamic script that then accepts the recording file and saves it as appropriate to that server. The server-side script would be in something like PHP, ASP, JSP, Perl, etc. as shown in the examples above. Regards, Jeff Kustermann Voxeo Support |
|
phoebus
|
|
| Noup, calling php (that exists, processes $_FILES and returns vxml) doesn't help, the line just hangs _prior to loading php file_):
(...) <data name="file" srcexpr="'http://(hidden_domain)/obdelaj.php?instanceId='+instanceId" namelist="pff" fetchhint="safe" fetchtimeout="1000" method="post" /> (...) Or, is there maybe a workaround for <submit> so that it would make a request in such way that it wouldn't get error 500?: (...) <submit next="http://(hidden_domain)/obdelaj.php" method="post" namelist="pff" enctype="multipart/form-data" /> (...) Apache: XXX.XXX.XXX.XXX - - [17/Jul/2009:05:09:15 -0700] "GET /index.vxml HTTP/1.1" 200 1965 "-" "OCMP-VoiceXML/3.1.1" XXX.XXX.XXX.XXX - - [17/Jul/2009:05:09:17 -0700] "POST /obdelaj.php HTTP/1.1" 500 867 "-" "OCMP-VoiceXML/3.1.1" Debug email: eventname: error.badfetch message : timeout 30000 ms src : http://(hidden domain)/obdelaj.php It doesn't help increasing or decreasing timeout- multipart/form-data just rerutns err 500... |
|
VoxeoDustin
|
|
| Hello,
I noticed a couple of issues with your submit that may cause a problem: <data name="file" srcexpr="'http://(hidden_domain)/obdelaj.php?instanceId='+instanceId" namelist="pff" fetchhint="safe" fetchtimeout="1000" method="post" /> You are setting the method to POST, but are appending a querystring. This is not necessary, as you can simply add instanceid to the namelist. As well, fetchtimeout here is set to 1 second, which will cause a failure almost immediately. Lastly, the encoding type multipart/form-data must be set here: <data name="file" src="http://(hidden_domain)/obdelaj.php" namelist="instanceid pff" fetchhint="safe" fetchtimeout="30s" method="POST" enctype="multipart/form-data"/> If you continue to have difficulty, please open an account ticket with logs of a failed call and the full code you are using so we can take a look. Regards, Dustin Hayre Customer Support Engineer II Voxeo Support |
|
santino
|
|
| Hello,
I used your example for recording audio and submiting to jsp and everything works fine. I have a problem with name of recorded file. It is smth like recording_vxi_dialog_... What I need is to change that name.Actually. I would like to put CallerID into name of wav file. Is it any solution in vxml or I have to learn jsp! BR Santino |
|
voxeoJason
|
|
| Hi,
Just to clarify when saving out recordings you would like to assign them a naming convention upon output and save correct? Regards, Jason Voxeo Support |
|
santino
|
|
| Hi,
I want to final audio file on my server have a name that include value of Caller ID. There is no matter to me is it done before or after submitting just it would be easier to understand for me if it is possible to be done using VXML. |
|
VoxeoDustin
|
|
| Hello Santino,
Here is simple PHP that will receive the recording from VXML and save it in the format [callerid]-[hoursminutessecond], e.g. 4075551212-104235.wav <?php // get our caller id to help identify the recording $callerid = $_REQUEST['callerid']; if ($_FILES["R_1"]["error"] > 0) { // oops, something went wrong. let's let our app know header("HTTP/1.1 500 Internal Server Error"); } else { // copy our temp file to our real file name and save it on the server. move_uploaded_file($_FILES["R_1"]["tmp_name"], "upload/" . $callerid . "-" . date("His") . ".wav"); } ?> This script expects two values in the HTTP request: R_1 - variable containing the recording itself callerid - variable containing the caller id Let me know if we can be of further assistance. Regards, Dustin Hayre Customer Support Engineer II Voxeo Support |
|
santino
|
|
| I'm really sorry I torturing you so much but I'm not allowed to install PHP. Is it possible to send me some jsp file instead.Something similar your example record_save.jsp or...
Sorry! BR Santino! |
|
jdyer
|
|
| Hello,
We do have a few more examples in our "All Things Audio" section of our documentation. There does appear to be a JSP example, if you wanted to give that a shot? The link to this section can be found here ( http://www.vxml.org/recording.htm ). I do hope this helps, and please let us know if there are any other questions as we are certainly standing by to assist! Regards, John Dyer Customer Engineer Voxeo Support |
|
santino
|
|
| Hello,
me again :( I didnt mention that I only need to save file in local directory and not to publish it on WEB site(if this make any easier to help me) Thanks! |
|
jdyer
|
|
| Hello,
I am afraid I am not clear on what you are trying to do here. Are you only looking to save the recording locally on a premise installation? If this is the case then you may want to investigate the voxeo:recordcall element, as this will write to recording directly to disk. I hope this helps, and if there are any other questions please let us know! Regards, John Dyer Customer Engineer Voxeo Support |
|
lonojohnson
|
|
| I am working on with the JSP example. I have downloaded the MultipartRequest file from com.oreilly.servlet - cos-26Dec2008.zip - that has the JAR jar file that contains the MultipartRequest class that is used in the example.
My question is where do I put and/or how to I 'install' the JAR file so that the Jetty Server (I assume that Jetty is interpreting/rendering the JSP) can find/use the class. I have some experience with Tomcat and JBoss, but I have not worked with Jetty before. The info that I could find on the Web was not very useful in addressing this issue. Any help would be appreciated. --CJ |
|
VoxeoDante
|
|
| Hello CJ,
Are you trying to install the jar using Prophecy's webserver, or your own? From the servlets.com site, the directions to install the package are as follows; "How do I install the com.oreilly.servlet package? Unzip the com.oreilly.servlets distribution file using a unzip utility like WinZip or jar. Inside you'll find a file cos.jar. Place this where your server will find it, such as the WEB-INF/lib directory for your web application. For server-wide availability you can also place it into the CLASSPATH used by your server. That's it! For more information on the WEB-INF directory see "Java Servlet Programming, 2nd Edition" and for more information on CLASSPATH entries see any introductory Java book." I hope this helps. Regards, Dante Vitulano Customer Support Engineer II Voxeo Corporation |
|
lonojohnson
|
|
| Dante,
Thanks for the information. I do not have a Web application (WAR file). So, for my app, I do not have a WEB-INF/lib directory to use. I am currently running a simple test app - a VoiceXML app that is located in ...Voxeo\webapps\www directory. The VoiceXML app is capturing a recording and then calling a JSP page (located in the same directory) to write the captured audio to disk. Therefore, I am using your (Voxeo's) JSP container (I assume its Jetty) to interpret/render the JSP page). The reason that I ask about the JAR file is that putting JAR files in the 'system class path' does not always work - e.g. JBoss will not necessary find/use the JAR, especially if you have 'endorsement' issues. I have had issues with some versions on Tomcat as well. Anyways, I will put the JAR in the system class path and what happens. Thanks, --CJ |
|
jdyer
|
|
| Hello CJ,
For Prophecy 9 you will want to use the put your JSP applications in a folder under the www/ directory (/opt/voxeo/webapps/www/MyCoolTestApp). If you do have library to add to the class path you will want to put these in a subDirectory of this folder (/MyCoolTestApp/WEB-INF). I do hope this helps, and if there are any other questions please let us know! Regards, John Dyer Customer Engineer Voxeo Support |
|
Hixxey
|
|
| I am having some problems saving a sound clip to a .wav file.
For the .JSP exmaple, what should go in the record_save.jsp file as I cannot find the code for this file? Also, I am saving a .wav file as a work around for voice to text. Is voice to text possible? For example, is it possible to tell the application your address and then save that to a plain text file? Thank You, Hixxey |
|
MattHenry
|
|
| Hi there,
I'll do my best to answer each quastion in trun below: Q: "For the .JSP exmaple, what should go in the record_save.jsp file as I cannot find the code for this file?" Matt: Apologies, this is a mis-lableing goof on our part in the code sample. The <submit> target should really point to the "SaveAudio.jsp" file directly beneath it in the docs: <submit next="http://myServer.com/SaveAudio.jsp" namelist="audio" enctype="multipart/form-data" method="post" /> Q: "Also, I am saving a .wav file as a work around for voice to text. Is voice to text possible? For example, is it possible to tell the application your address and then save that to a plain text file?" Matt: Arbitrary voice-to-text translation is still something that today's technology doesn't do such a good job at. To be clear, this isn't a voxeo limitation per-se, but a problem with recognition technology in general. The short answer to the question of "whats the best way to get voice-to-text translations" is to use a transcription service...as chance has it, we have a few trusted partners that we refer developers to; should you be interested in pursuing this option, you can contact sales@voxeo.com to learn more. Hope this helps, ~Matthew Henry |
|
Hixxey
|
|
| Thanks for the reply. The server I am using does not have the imports for apache so is there another way of saving a file without using these imports?
Thank You, Hixxey |
|
voxeoTonyT
|
|
| Hello,
Following the vxml specifications audio files will not exist beyond the life of the session. Since that is the limitation we are dealing with the audio file will need to be saved and uploaded before the session terminates. Having said that there really is no other alternative at this point aside from using server side code to upload an audio file to a server or host you can retrieve it from. Just as the tutorial demonstrates you can use other forms of server side scripting besides jsp to upload the audio file to another host. I hope this helps you, but let us know if you have additional questions. Regards, Tony Taveras Customer Engineer Voxeo Support |
|
honey_singla85
|
|
| Is necessary "cut" the "file://localhost/" to get the correct file path.
record.vxml <?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="php/upload.php" method="post" namelist="file" enctype="multipart/form-data" /> </filled> </record> </form> </vxml> upload.php <? header('Cache-Control: no-cache'); include 'util.php'; $MAX_FILE_SIZE = 15000000; $folder = "/tmp/"; $logfile = "log.txt"; // Post variables $fname = $HTTP_POST_FILES['file']['name']; $ftype = $HTTP_POST_FILES['file']['type']; $fsize = $HTTP_POST_FILES['file']['size']; $ftmp = $HTTP_POST_FILES['file']['tmp_name']; //save log $handler=fopen($folder.$logfile,"w"); fwrite($handler,the_file_name($fname)); fclose($handler); if($fize > $MAX_FILE_SIZE){$error = 2;} if(file_exists($folder."m_".$fname)){$error = 3;} if(copy(the_file_name($fname),$ftmp."wav")) {$error = 0;} switch($error){ case'0': $mensaje="File saved Ok."; break; case'1': $mensaje="Incorrect Format."; break; case'2': $mensaje="File so Big."; break; case'3': $mensaje="File already exists."; break; } echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"; echo "<vxml version=\"2.0\">"; echo "<form id=\"main\">"; echo "<block>"; echo $mensaje; echo "</block>"; echo "</form>"; echo "</vxml>"; ?> util.php <?php function the_file_name($file){ $j=0; $l=strlen($file); for ($k=0;$k<=$l;$k++){ if (substr($file,$k,1)=='/'){ $j++; if ($j==3){ return substr($file,$k); } } } return ""; } ?> Greetings, I tried this but its giving error , I am not able to understand whu its giving an error and also its not creating any folder in root directory with name tmp., kindly help me in this regard, what i want is to get recoding input from user and save it to wav file on the server. regards, Honey |
|
voxeoJeffK
|
|
| Hello,
There is limited assistance we can provide for PHP on an external server. We would recommend checking that permissions are set to allow the script to write to that folder. The error that is generated by PHP may be of some help as to what is occurring as well. Regards, Jeff Kustermann Voxeo Support |
|
navinsharma2683
|
|
| Hi,
I want to store my voice in .jsp server side script. but my voice is not save and givers the error 500.my jsp file is not read.please help me how can I store my voice in server side script in jsp.my code is below attached.if anyone found error please correct it and posted its urgent. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" pageEncoding="utf-8" %> <%@ page import="org.apache.commons.fileupload.*"%> <%@ page import="org.apache.commons.fileupload.servlet.*"%> <%@ page import="org.apache.commons.fileupload.disk.*"%> <%@ page import="java.util.*"%> <%@ page import="java.sql.*"%> <%@ page import="java.io.*"%> <%@ page import="java.util.Date"%> <%@ page import="java.text.DateFormat"%> <%@ page import="java.text.SimpleDateFormat"%> <?xml version='1.0'?> <vxml version="2.0"> <form> <% DateFormat dateFormat = new SimpleDateFormat("yyyy_MM-dd_HH:mm:ss"); Date date = new Date(); boolean isMultipart = ServletFileUpload.isMultipartContent(request); System.out.println("request"+request); FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List fileItems = null; try { fileItems = upload.parseRequest(request); System.out.println("fileitems"+fileItems); } catch (Exception e) { e.printStackTrace(); } try { Iterator iter = fileItems.iterator(); while (iter.hasNext()) { FileItem item = (FileItem) iter.next(); String newFileName = "Recording-" + dateFormat.format(date); String inputFilePath = "/var/ftp/pub/"+ newFileName + ".wav"; File file = new File(inputFilePath); try { //Writing the wav file item.write(file); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } %> <block> <prompt> Audio upload complete! </prompt> </block> </form> </vxml> |
|
VoxeoDante
|
|
| Hello,
I am afraid that we are not terribly equipped to troubleshoot server-side scripts for saving off the audio files. I would suggest taking a look at the response that comes back from the server and seeing where the failure is occurring. Generally a JSP server will tell you where the error is somewhat. Beyond that, we are not really be best team to help. I would suggest taking a look at the stack, which should point you in the right direction. Regards, Dante Vitulano Hosted Solutions Engineer [url=http://voxeo.com/prophecy]Download Prophecy 10[/url] | [url=http://docs.voxeo.com/prophecy/10.0/home.htm]Prophecy 10 Docs[/url] |
| login |
|