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

why is <reprompt/> replaying previous fields?

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
ban
Posts: 21
Joined: Mon May 03, 2004 1:39 pm

why is <reprompt/> replaying previous fields?

Post by ban »

I thought <reprompt /> was only supposed to replay the prompts from within the same <field>.

However, I have a voiceXML file with some introductory text, then multiple questions, where the introductory text is within <block><audio> tags (no <prompt>) and each question is contained within <field> tags. If the user does not enter a valid answer for question 2, the introductory text, and question 1 both repeat.

Here is the voiceXML (encompassing <form> and <vxml> tags omitted)

Code: Select all

<block>
  <audio src="/vxml/audio/dummy.wav">Hello. This is a test to see if you know your numbers.</audio> 
</block>
  <field name="field120" type="number" modal="false">
    <prompt bargein="false" version="1.0">
      <audio src="/vxml/audio/dummy.wav">Please enter a number between 10 and 20.
      </audio> 
    </prompt>
    <filled>
      <if cond="field120<10">
        The value <value expr="field120" /> is not valid 
        <clear /> 
      </if>
    </filled>
   <filled>
     <if cond="field120>20">
       The value <value expr="field120" /> is not valid 
       <clear /> 
     </if>
   </filled>
  <nomatch>
    <audio src="/vxml/audio/sorry.wav">Sorry I didn't   understand
    </audio> 
    <audio src="/vxml/audio/useKeyboard.wav">You can also enter the value using the keypad.
    </audio> 
    <reprompt /> 
  </nomatch>
</field>


<field name="confirm120" modal="false">
  <grammar type="application/x-jsgf" mode="voice">(yes|1) {yes} | (no | 2) {no}</grammar> 
  <prompt bargein="false" version="1.0">
    <audio src="/vxml/audio/dummy.wav">
      You entered <value expr="field120" /> 
    </audio>
    <audio src="/vxml/audio/isCorrect.wav">
      Is this correct?
    </audio> 
  </prompt>
  <filled>
    <if cond="confirm120=='no'">
      <clear namelist="field120 confirm120" /> 
      <goto nextitem="field120" /> 
    </if>
  </filled>
</field>


<field name="field119" type="number" modal="false">
  <prompt bargein="false" version="1.0">
    <audio src="/vxml/audio/dummy.wav">
      Please enter a number between 30 and 50.
    </audio> 
  </prompt>
  <filled>
    <if cond="field119<30">
      The value <value expr="field119"/> is not valid 
      <clear /> 
    </if>
  </filled>
  <filled>
    <if cond="field119>50">
      The value <value expr="field119" /> is not valid 
      <clear /> 
    </if>
  </filled>
  <nomatch>
    <audio src="/vxml/audio/sorry.wav">
      Sorry I didn't understand
    </audio> 
    <audio src="/vxml/audio/useKeyboard.wav">
      You can also enter the value using the keypad.
    </audio> 
    <reprompt /> 
  </nomatch>
</field>


<field name="confirm119" modal="false">
  <grammar type="application/x-jsgf" mode="voice">(yes|1) {yes} | (no | 2) {no}</grammar> 
  <prompt bargein="false" version="1.0">
    <audio src="/vxml/audio/dummy.wav">
      You entered <value expr="field119" /> 
    </audio>
    <audio src="/vxml/audio/isCorrect.wav">
      Is this correct?
    </audio> 
  </prompt>
  <filled>
    <if cond="confirm119=='no'">
      <clear namelist="field119 confirm119" /> 
      <goto nextitem="field119" /> 
    </if>
  </filled>
</field>

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

IVR example using <if> and <else> tags

Post by support »

Hi ban:


A couple notes on your vxml:

* the <clear> tag expects a namelist. by not specifying a namelist of variables to clear, you are clearing all variables in the given scope (current scope is the form, so all variables in the form are cleared)
The Plum IVR Platform attempts to maintain w3c spec compliance on all vxml related behavior;This is defined in the online spec maintained at:
http://www.w3.org/TR/voicexml20/#dml5.3.3

*the <reprompt> tag upon being called will start execution at the first unfilled/unvisited item in the current scope. In this case the given scope is your form. This is related to the above note regarding the clear tag; calling <clear/> without a namelist will set the <block> containing your welcome message to the unvisited/unfilled state, and cause it to be revisited upon calling <reprompt/>.

* in your javascript, you should be escaping the equality operators for greater than (>) and less than (<) . This will lead to parsing errors when attempting to validate or load the xml if these characters are not escaped. (see below for an example)

*you should only specify one <filled> tag per field, for the sake of clarity. You can use <if> and <else> tags to do this, consult the Plum IVR programmers reference manual. Here's an IVR example of another way to fix this:

Code: Select all

<filled>
  <if cond="field120 < 10">
    The value <value expr="field120" /> is not valid
    <clear />
  </if>
  <if cond="field120 > 20">
    The value <value expr="field120" /> is not valid
    <clear />
  </iif>
</filled>

The behavior for these tags are defined in the Plum IVR Programmer's reference manual, available here:

http://www.plumvoice.com/docs/dev/voicexml:tags

when in doubt concerning behavior of IVR tags, consult this reference first.

Hope this helps!

Support
Last edited by support on Thu Feb 25, 2010 5:06 pm, edited 4 times in total.

ban
Posts: 21
Joined: Mon May 03, 2004 1:39 pm

Post by ban »

thanks, i realized that I was clearing all my variables right after I posted that note. As soon as I specified which one(s) to clear, the script functioned properly.

I am escaping the characters - I was showing you what displays in the browser.

thanks for the clarification.

Post Reply