Export (0) Print
Expand All

exit

Terminates the running application.

<exit 
expr = "ECMAScript_Expression"
namelist = "string"
/>

expr

An ECMAScript expression that evaluates to a value returned to the interpreter context.

namelist

A space-separated list of variables to be returned to the interpreter context.

The exit element immediately ends the VoiceXML dialog session, clearing the execution stack for the running application.

The Tellme VoiceXML interpreter currently does not utilize the data returned via the expr or namelist attributes. Prior to Revision 3, the interpreter ignores any undeclared variables in the namelist attribute. In Revision 3 and later, the interpreter throws error.semantic if any of the variables is undeclared.

The following example asks the user to say the name of a fruit. The fourth nomatch event handler and the third noinput handler execute the exit element to terminate the application.

<?xml version="1.0"?>
<vxml version="2.1"
 xmlns="http://www.w3.org/2001/vxml">
   <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 weight="1.0">
                              help
                        </item>
                  </one-of>
            </rule>

      </grammar>

      
      <grammar mode="dtmf"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              0
                        </item>
                  </one-of>
            </rule>

      </grammar>

   </link>

   <form id="pick_fruit">

   <field name="fruit">
      <prompt>
      Pick a fruit
      </prompt>

      
      <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>
                        <item>
                              <one-of>
                                    <item>
                                          repeat
                                    </item>
                              </one-of>
                              <tag>out.fruit = "repeat";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>

      
      <grammar mode="dtmf"
         root="root_rule"
         tag-format="semantics/1.0"
         type="application/srgs+xml"
         version="1.0">
            <rule id="root_rule" scope="public">
                  <one-of>
                        <item>
                              <one-of>
                                    <item>
                                          1
                                    </item>
                              </one-of>
                              <tag>out.fruit = "apple";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          2
                                    </item>
                              </one-of>
                              <tag>out.fruit = "orange";</tag>
                        </item>
                        <item>
                              <one-of>
                                    <item>
                                          3
                                    </item>
                              </one-of>
                              <tag>out.fruit = "pear";</tag>
                        </item>
                  </one-of>
            </rule>

      </grammar>


      <!-- handle the first nomatch for this field -->
      <nomatch count="1">
         I'm sorry. I didn't get that.
         <reprompt/>
      </nomatch>

      <!-- handle the second nomatch for this field -->
      <nomatch count="2">
         I'm sorry. I still didn't get that. Please say apple, orange or pear.
      </nomatch>

      <!-- handle the third nomatch for this field -->
      <nomatch count="3">
         I must be losing it because I still didn't get that. 
         Let's try this another away. 
         For an apple, press 1. 
         For an orange, press 2.
         For a pear, press 3.
      </nomatch>

      <!-- handle the fourth and final nomatch for this field -->
      <nomatch count="4">
         <exit/>
      </nomatch>

      <!-- handle all noinput events for this field -->
      <noinput count="1">
         I'm sorry. I didn't hear you.
         <reprompt/>
      </noinput>

      <noinput count="2">
         I'm sorry. I still didn't hear you.
         <reprompt/>
      </noinput>

      <noinput count="3">
         <exit/>
      </noinput>

      <!-- handle all help events for this field -->
      <help>
         Say apple, orange, or pear.
      </help>

      <filled>
      <log>Recognized <value expr="fruit"/></log>
      <if cond="'repeat' == fruit">
         <clear namelist="fruit"/>
         <reprompt/>
      <else/>
         you chose <value expr="fruit"/>
         <exit />
      </if>
      </filled>

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

Community Additions

ADD
Show:
© 2014 Microsoft