Page 1 of 1

Error Handling - Adding "catch all" logic for &quo

Posted: Sun Sep 28, 2008 12:34 pm
by metroscript
Good afternoon to all,

Currently, we have some error handling in our logic which catches some type of errors, but not all. Here is an example of our error handling on one of our xml pages:

Code: Select all

<catch event="connection.disconnect">
	<if cond="initial_recording == undefined">
		<% if ( strFrom = "pause" ) then %>
			<submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
		<% else %>
			<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
		<% end if %>
	<elseif cond="initial_recording$.size < 24000 || initial_recording$.size == ''"/>
		<% if ( strFrom = "pause" ) then %>
			<submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
		<% else %>
			<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
		<% end if %>
	<else/>
		<submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
	</if>
</catch>

<catch event="error.badfetch" count="1">
	<if cond="initial_recording$.size == 0 || initial_recording$.size == '' || initial_recording == undefined">
		<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
	<else/>
		<submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
	</if>
</catch>
		
<catch event="error.badfetch" count="2">
	<var name="filename" expr="foldernumber + '_phone_file_' + filenumber + '.vox'"/>
	<var name="recording" expr="initial_recording"/>
	<submit next="http://metroscript.plumgroup.com/saverecording.php" namelist="filename recording" method="post" enctype="multipart/form-data"/>
</catch>

<catch event="nomatch noinput">
	<submit next="process_record_hangup.xml" method="post"/>
</catch>

What I am looking to do is add logic which would catch and handle any other type of errors. So, this is what I came up with. My question is, does my logic make sense and is this how you would accomplish this:

Code: Select all

<error>
	<if cond="_event =='connection.disconnect'">
		<if cond="initial_recording == undefined">
			<% if ( strFrom = "pause" ) then %>
				<submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
			<% else %>
				<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
			<% end if %>
		<elseif cond="initial_recording$.size < 24000 || initial_recording$.size == ''"/>
			<% if ( strFrom = "pause" ) then %>
				<submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
			<% else %>
				<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
			<% end if %>
		<else/>
			<submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
		</if>
	<elseif cond="_event =='error.badfetch' " count="1"/>
		<if cond="initial_recording$.size == 0 || initial_recording$.size == '' || initial_recording == undefined">
			<submit next="process_record_hangup.xml?next=zerolength" method="post"/>
		<else/>
			<submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
		</if>
	<elseif cond="_event =='error.badfetch' " count="2"/>
		<var name="filename" expr="foldernumber + '_phone_file_' + filenumber + '.vox'"/>
		<var name="recording" expr="initial_recording"/>
		<submit next="http://metroscript.plumgroup.com/saverecording.php" namelist="filename recording" method="post" enctype="multipart/form-data"/>
	<elseif cond="_event =='nomatch noinput' "/>
		<submit next="process_record_hangup.xml" method="post"/>
	<else/>
		<submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
	</if>
</error>
Thanks,

Mike C.

FIx to IVR code to catch and handle any other type of errors

Posted: Mon Sep 29, 2008 11:51 am
by support
Hi Mike,

Looking through your IVR code:

Code: Select all

<error>
   <if cond="_event =='connection.disconnect'">
      <if cond="initial_recording == undefined">
         <% if ( strFrom = "pause" ) then %>
            <submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
         <% else %>
            <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
         <% end if %>
      <elseif cond="initial_recording$.size < 24000 || initial_recording$.size == ''"/>
         <% if ( strFrom = "pause" ) then %>
            <submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
         <% else %>
            <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
         <% end if %>
      <else/>
         <submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
      </if>
   <elseif cond="_event =='error.badfetch' " count="1"/>
      <if cond="initial_recording$.size == 0 || initial_recording$.size == '' || initial_recording == undefined">
         <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
      <else/>
         <submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
      </if>
   <elseif cond="_event =='error.badfetch' " count="2"/>
      <var name="filename" expr="foldernumber + '_phone_file_' + filenumber + '.vox'"/>
      <var name="recording" expr="initial_recording"/>
      <submit next="http://metroscript.plumgroup.com/saverecording.php" namelist="filename recording" method="post" enctype="multipart/form-data"/>
   <elseif cond="_event =='nomatch noinput' "/>
      <submit next="process_record_hangup.xml" method="post"/>
   <else/>
      <submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
   </if>
</error> 
this probably wouldn't work due to these lines:

Code: Select all

<elseif cond="_event =='error.badfetch' " count="1"/> 

Code: Select all

<elseif cond="_event =='error.badfetch' " count="2"/> 
since there is no "count" attribute for the IVR <elseif> tag.

We recommend that you just keep your old IVR code and just add an <error> handler to your IVR code to handle any other types of IVR errors:

Code: Select all

<catch event="connection.disconnect">
   <if cond="initial_recording == undefined">
      <% if ( strFrom = "pause" ) then %>
         <submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
      <% else %>
         <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
      <% end if %>
   <elseif cond="initial_recording$.size < 24000 || initial_recording$.size == ''"/>
      <% if ( strFrom = "pause" ) then %>
         <submit next="process_combine_voxs.xml?next=disconnect" method="post"/>
      <% else %>
         <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
      <% end if %>
   <else/>
      <submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
   </if>
</catch>

<catch event="error.badfetch" count="1">
   <if cond="initial_recording$.size == 0 || initial_recording$.size == '' || initial_recording == undefined">
      <submit next="process_record_hangup.xml?next=zerolength" method="post"/>
   <else/>
      <submit next="process_record_savevox.xml?next=disconnect" method="post" namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/>
   </if>
</catch>
      
<catch event="error.badfetch" count="2">
   <var name="filename" expr="foldernumber + '_phone_file_' + filenumber + '.vox'"/>
   <var name="recording" expr="initial_recording"/>
   <submit next="http://metroscript.plumgroup.com/saverecording.php" namelist="filename recording" method="post" enctype="multipart/form-data"/>
</catch>

<catch event="nomatch noinput">
   <submit next="process_record_hangup.xml" method="post"/>
</catch> 

<error>
   <submit next="process_record_savevox.xml?next=disconnect" method="post namelist="initial_recording" fetchtimeout="120s" enctype="multipart/form-data"/> 
</error>
Regards,
Plum Support

Posted: Mon Sep 29, 2008 5:45 pm
by metroscript
Thanks for the quick reply. So, if I understand correctly, it will still go through my original catches first with this solution?

IVR code for <error> handler

Posted: Tue Sep 30, 2008 8:39 am
by support
Hi,

Yes, that's correct for the IVR application. It would go through all of your original catches first and if there's a match, then it would use that <catch> event. If there isn't a match, it would just go to your <error> handler.

Regards,
Plum Support

Posted: Tue Sep 30, 2008 10:21 am
by metroscript
Sounds good. Thx!

Posted: Tue Oct 07, 2008 6:59 pm
by metroscript
One last question. I have a page which contains multiple <menu> tags. Within each of those <menu> tags, I have a <disconnect> tag. I also have a <disconnect> tag at the top of the page in case the user doesn't get to any of the <menus>. So, my question is this. Should I have a universal <error> handler after each of my <disconnect> tags? Will that cause a problem?

Thanks!

Mike C.

IVR application and handling errors

Posted: Wed Oct 08, 2008 9:00 am
by support
Hi Mike,

As long as the error handler that you specify in each of your IVR <menu> tags is the same, you can just specify the error handler once at the vxml-level or once at the application-level.

To answer your second question, having the same <error> handler after each of your IVR <disconnect> tags wouldn't cause an IVR problem.

Regards,
Plum Support

Posted: Wed Oct 08, 2008 12:30 pm
by metroscript
The problem is that each menu has a unique <disconnect> handler, which means that each general <error> handler after each <disconnect> would be unique. Would that be an issue?

IVR script for handling errors

Posted: Wed Oct 08, 2008 12:35 pm
by support
Hi Mike,

Yes, this would be an IVR issue.

If each general <error> handler is unique, then you should add an <error> handler after each <disconnect> in your IVR <menu> tags.

Regards,
Plum Support