Jump to content

ASP stream object and VoiceXML


embassy17

Recommended Posts

Good morning/afternoon/evening to all,First time post/long time user.I'm trying to use a voicexml tag to retrieve a wav file via the stream object andI am receiving a great deal of static in the returned object. I realize many of youmay not have experience in VoiceXML, but I'm hoping there is something I'm doing incorrectly in my ASP code.I have two files: process_record_review.xml and audio.xml process_record_review.xml has a voicexml tag called <audio> which plays back whatever file you want. audio.xml contains the ASP stream object to get the wav file to play back. I have the <audio> tag in process_record_review.xml pointing to audio.xml, so it will get the ASP stream object which contains the wav file.This is the process_record_review.xml piece containing the xml <audio> tag:<form id="replay"> <block> <prompt><audio expr="'audio.xml'"/></prompt> </block></form>This is the audio.xml which gets the wav file via the ASP stream object:<?xml version="1.0"?><vxml version="2.0"><%dim strAudioFilePathdim strAudioFileNamestrAudioFilePath = "m:\WebSites\wavfile.wav" strAudioFileName = "wavfile.wav"Set objStream = Server.CreateObject("ADODB.Stream")objStream.OpenobjStream.Type = 1objStream.LoadFromFile strAudioFilePathContentType = "audio/wav"stream = objStream.Read()objStream.CloseSet objStream = NothingResponse.ClearResponse.Buffer = TrueResponse.AddHeader "Content-Disposition", "attachment; filename=" & strAudioFileNameResponse.AddHeader "Content-Length", Len(stream)Response.Charset = "UTF-8"Response.ContentType = ContentTypeResponse.BinaryWrite streamResponse.Flush%></vxml> Here is what works and doesn't work:1. The wav file plays back clear if I just hard code the wav file URL in the <audio> tag in process_record_review.xml and do not call the audio.xml file.-This tells me that the voicexml <audio> tag will successfully play back a wav file 2. The wav file plays back clear if I just type in ....../audio.xml into my browser.-This tells me that the stream object in audio.xml works fine. 3. The wav file plays back staticy if I have the <audio> tag in process_record_review.xmlpoint to audio.xml to retrieve the wav file via the stream object. So, the <audio> tag in process_record_review.xml is successfully making it to audio.xml. It gets the stream object,but doesn't play it clear. I'm really lost on this one. I've googled the crap out of this, but I think I'm the only person to ever to do this. Any suggestions would be appreciated :) Thanks again,Mike C.

Link to comment
Share on other sites

I can only think of one possible problem. You haven't adjusted ASP to run on XML files.Every file with .xml extension will be passed "as is" and scince the raw ASP code is making the XML ill-formed, nothing works.The solution? Rename audio.xml or whatever file contains ASP to audio.asp.If that doesn't work... well... hm... maybe the user agent doesn't support the expr attribute. Have you tried hardcoding the URL into audio.xml while keeping the expr attirubte in process_record_review.xml and run the WAV from process_record_review.xml?If that doesn't work, it's the user agen't fault and there's nothing you can do, other then dynamically generating the URL in one of the files, without pointers to the other.

Link to comment
Share on other sites

Thanks for the advice. I tried solution 1, which was to rename audio.xml to audio.asp. No luck. Thewav file produced was still filled with static. I tried solution 2, which was to hardcode the url into audio.xml.Still got the same results. My buddy was able to do this using Perl in his "audio.xml" file, but I need to useASP. Any other advice would be appreciated. Thanks again everybody.Mike C.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...