Export (0) Print
Expand All

prompt

Queues recorded audio and synthesized text to speech in an interactive dialog.

<prompt 
bargein = "boolean"
bargeintype = "string"
cond = "ECMAScript_Expression"
count = "integer"
timeout = "seconds_milliseconds"
/>

bargein

Controls whether or not a user can interrupt the system. The property applies to both DTMF and spoken input. For more information on controlling bargein, see Understanding bargein.

falseDisables the user's ability to interrupt queued prompts by speaking during audio playback. Disabling bargein may displease users, but it can be used effectively when you want to ensure the user hears a prompt in its entirety.
trueEnables the user's ability to interrupt queued audio during audio playback.

bargeintype

When bargein is enabled, this controls the type of bargein that will be performed in response to voice or DTMF input.

hotwordA prompt will continue playing until either a complete match of an active grammar is detected or there is no input during the time specified for the interpreter to listen for input.
speechA prompt is stopped as soon as speech or DTMF input is detected, irrespective of whether the input matches a grammar.

cond

A condition that determines whether or not the prompt is eligible to be played.

count

Each field maintains a prompt counter which tracks the number of times a prompt has been executed since the form was entered. The counter is reset when the VoiceXML interpreter enters the form. The prompt with the highest count attribute less than or equal to the prompt counter is played. If multiple prompt elements exist with the same count, the VoiceXML interpreter only executes the first one encountered in document source order. The default value is 1.

timeout

The number of seconds (s) or milliseconds (ms) the platform waits for user input before throwing a noinput event. If multiple prompt tags specify a timeout, the last one is used.

The prompt element prompts the user for input by queueing the audio elements and text that it contains. The prompt element is typically used in an interactive dialog as a child of the form element. It can also be used as a generic container for raw text and speech markup elements such as the break element.

Prior to Revision 3, the bargein attribute was ignored. The only way to control bargein was using the bargein property.

If the bargein or bargeintype attribute is not specified for a prompt element, then the value of the bargein or bargeintype property, respectively, is used.

In the following example, the user is prompted to say the name of a fruit. The first time the user doesn't say anything or says something other than apple, orange, or pear, the combined nomatch/noinput handler is executed, and the second prompt element is executed. After the second nomatch or noinput, the audio contained in the combined nomatch/noinput handler is played, but neither prompt element is executed because the reprompt element is not specified in the second handler.

In the following sample transcript, when the user says "mango", the first combined nomatch/noinput handler is executed, and the second prompt element is executed. When the user says "kiwi", the second combined nomatch/noinput handler is executed. When the user says nothing, the first combined nomatch/noinput is executed because the VoiceXML interpreter maintains separate counters for nomatch and noinput events - even if the handlers are combined.

Tellme:

Pick a fruit.

Caller:

mango (aka nomatch count=1)

Tellme:

Sorry. I didn't get that. Say the name of a fruit. For example, say apple.

Caller:

kiwi (aka nomatch count=2)

Tellme:

Sorry. I didn't get that. Please say apple, orange, or pear.

Caller:

(noinput count=1)

Tellme:

Sorry. I didn't get that. Say the name of a fruit. For example, say apple.

Caller:

apple

Tellme:

You picked apple.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">

  <link event="event.exit">
  
  <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
    <rule id="root_rule" scope="public">
      <one-of>
        <item>
          quit
        </item>
      </one-of>
    </rule>

  </grammar>

  </link>

  <link event="help">
  
  <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
    <rule id="root_rule" scope="public">
      <one-of>
        <item>
          help
        </item>
      </one-of>
    </rule>

  </grammar>

  </link>

   <catch event="event.exit">
      <exit />
   </catch>

  <form id="pick_fruit">
    <block>
       Welcome to the fruit picker. Say quit at any time.
    </block>

    <field name="fruit">
      
      <grammar mode="voice"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0"
         xml:lang="en-US">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              <one-of>
                                    <item>
                                          apple
                                    </item>
                              </one-of>
                              <tag>out.fruit = "apple";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          orange
                                    </item>
                              </one-of>
                              <tag>out.fruit = "orange";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          pear
                                    </item>
                              </one-of>
                              <tag>out.fruit = "pear";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>


      <prompt count="1">
        Pick a fruit.
        <break size="medium"/>
      </prompt>

      <prompt count="2">
        Say the name of a fruit. For example, say apple.
        <break size="medium"/>
      </prompt>

      <help>
         You're in the fruit picker.
         <reprompt/>
      </help>

      <catch event="noinput nomatch">
        Sorry. I didn't get that.
        <reprompt/>
      </catch>

      <catch event="noinput nomatch" count="2">
        Sorry. I didn't get that.
        Please say apple, orange, or pear.
      </catch>

      <filled>
        You picked <value expr="fruit"/>
        <!-- clear the form item variable to pick another -->
        <clear namelist="fruit"/>
      </filled>

    </field>
  </form>
</vxml>

Community Additions

ADD
Show:
© 2014 Microsoft