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

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

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
metroscript
Posts: 78
Joined: Mon Sep 25, 2006 6:52 am
Contact:

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

Post 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.

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

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

Post 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
Last edited by support on Wed Feb 17, 2010 3:39 pm, edited 3 times in total.

metroscript
Posts: 78
Joined: Mon Sep 25, 2006 6:52 am
Contact:

Post by metroscript »

Thanks for the quick reply. So, if I understand correctly, it will still go through my original catches first with this solution?

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

IVR code for <error> handler

Post 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
Last edited by support on Mon Jan 11, 2010 1:18 pm, edited 2 times in total.

metroscript
Posts: 78
Joined: Mon Sep 25, 2006 6:52 am
Contact:

Post by metroscript »

Sounds good. Thx!

metroscript
Posts: 78
Joined: Mon Sep 25, 2006 6:52 am
Contact:

Post 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.

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

IVR application and handling errors

Post 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
Last edited by support on Wed Feb 24, 2010 3:15 pm, edited 4 times in total.

metroscript
Posts: 78
Joined: Mon Sep 25, 2006 6:52 am
Contact:

Post 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?

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

IVR script for handling errors

Post 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

Post Reply