Page 1 of 1

How can I catch 404 error?

Posted: Fri Feb 05, 2010 4:48 pm
by w2gi
Hi,
I want to catch 404 error thrown in log.

Code: Select all

Cache Miss: http://ivr.somesite.com/prompts/725.wav
Attempting to fetch http://ivr.somesite.com/prompts/725.wav
HTTP/1.1 404 Not Found - http://ivr.somesite.com/prompts/725.wav
Audio segment from the URL http://ivr.somesite.com/prompts/725.wav added to prompt queue
Unrecognized format in pvxPromptConvertCopySource
Failure during pvxPromptConvertCopySource
I tried this, but it doesn't work:

Code: Select all

<catch event="error.badfetch.http.404">
   FOO      
</catch>
Any other methods?


- Saif

workaround for your IVR code

Posted: Mon Feb 08, 2010 10:37 am
by support
Hi,

You wouldn't be able to catch this 404 error in this implementation of your IVR code as there is no error that is thrown when the audio file can't be fetched. However, as a possible workaround to catch if the audio file was fetched or not, you could do:

Code: Select all

<?php
header("Content-type: text/xml");
echo("<?xml version=\"1.0\"?>\n");
?>
<vxml version="2.0">
<var name="trackfetch" expr="1"/>
  <form>
    <block>
      <prompt>
        I'm going to play an audio file.
      </prompt>
      <audio src="http://www.ourappserver.com/test.wav">
        <value expr="trackfetch++"/>
      </audio>
      <prompt>
        The trackfetch counter is <value expr="trackfetch"/>.
      </prompt>
    </block>
  </form>
</vxml>
From this IVR code example, we use the variable, trackfetch, to keep track of whether our audio file was fetched or not. If the audio file was not fetched, the IVR application will go to the <value> tag, which gets incremented by 1. If the audio file was fetched, the IVR application will just play the audio file and not go to the <value> tag. From this IVR code implementation, you could then go into your logs and track where your variable got incremented, which will also tell you which audio files did not get played.

Regards,
Plum Support