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

Am I able to use the <catch> tag to catch error.semant

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Am I able to use the <catch> tag to catch error.semant

Post by jcanter »

Am I able to use the <catch> tag to catch error.semantic errors. I would like to transfer out of the IVR in the event that something happens. I am trying this, but is not working for me:

Code: Select all

  <catch event="error.semantic">
    <goto next="xfer.vxml"/>
  </catch>

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

use the <catch> tag to catch error.semant in IVR syste

Post by support »

The two most common reasons an error.semantic is thrown are:

1. The VXML document is malformed.
2. Invalid ECMAScript is executed.

The first case cannot be caught. Since VXML is based on XML it is unable to do analysis of the IVR code if it is malformed, and so cannot react to IVR errors in the VXML because of this.

The second case can be caught. However, Plum recommends attempting to resolve all error.semantic errors before putting an IVR system into production. For all other conditions that throw an error.semantic please refer to the VXML 2.0 specification. http://www.w3.org/TR/voicexml20/
Last edited by support on Thu Feb 25, 2010 5:54 pm, edited 3 times in total.

jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Post by jcanter »

So, for example, if I call a php script that returns a malformed vxml document, I cannot do anything about that error. My problem is that I have a php script using curl. If the PHP script times out communicating with a website, CURL is returning a timeout message in the php headers, which is then causing the plumvp to throw an error.semantic. I would like to just transfer the call should I not be able to comminicate with the website. I have attempted to also set the timeout property in the <subdialog> tag, but since my php script is giving a response, plumvp never actually times out. Is there another way that I can handle this?

jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Post by jcanter »

Just to be clear here, this is how things are working: plumvp->myphp script->external website.

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

IVR issue with curl functions

Post by support »

Unfortunately, I have not been able to get curl to output any error messages. However, there is a facility in php for supressing error messages. You can place any offending IVR code inside a <block> as follows:

Code: Select all

$name = "/some/nonexistant/file";
ob_start(); // creates a catchall buffer
$fd = fopen($name,"wb");
ob_end_clean();  //silently discard buffer contents
Also, php functions have an IVR error supressing mode available by prepending them with an @. I am not aware if this method is supported by the curl functions. Here is an IVR example that would have the same output as above:

Code: Select all

$name = "/some/nonexistant/file";
$fd = @fopen($name,"wb");
If this does not resolve your IVR issue, please post an excerpt from your php code as I have not been able to reproduce the output issues you are having.
Last edited by support on Thu Feb 25, 2010 5:55 pm, edited 2 times in total.

jcanter
Posts: 47
Joined: Thu Jun 19, 2003 8:54 am

Post by jcanter »

Here is an example. If this code times out, an error is returned that is causing plumvp to throw an error.semantic. I cannot provide the acutal url as it is an internal site.

Code: Select all


  $url = "http://someplace.com";

  ob_start();
  $ch = curl_init ( $url );

  curl_setopt ($ch, CURLOPT_HEADER, 0);
  curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_COOKIEJAR, COOKIEJAR);
  curl_setopt ($ch, CURLOPT_TIMEOUT, 15);

  @curl_exec ($ch);
  curl_close ($ch);
  ob_end_clean();

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

IVR Debugging tips

Post by support »

The IVR code you have pasted in looks correct in regards to how the curl library is used in php, but since the IVR code was taken out of context, it's hard to tell what's causing the problem.

Here's some things to keep in mind:
* try isolating the curl code into a simpler test page to narrow down the problem; it's possible that other vxml in the script is the culprit.

* When debugging php, it's much easier to use a web browser; VXML error messages are not a good way to debug PHP. Point your browser to the php script directly and make sure there arent any IVR errors in the resulting page. If there are IVR errors, the resulting page will give you the line number in the php file causing the problem.

* Its possible one of the curl options you are setting may be incorrect. consult http://www.php.net/docs.php to confirm this is not the case.

* There is a curl option "CURLOPT_MUTE" you may want to make sure that this is set to 1.

Hope these IVR debugging tips help :!:

Post Reply