disconnect element
Last Updated: 09-26-2005
VoiceXML 2.0
Terminates the phone call.


namelist = "string"

A space-separated list of variables to be submitted via HTTP to the specified document.



If you use the transfer element to connect to a second application that uses a disconnect element, control is returned to the original application.
The disconnect element causes the Platform to hang up on the user, which in turn causes the Platform to throw a telephone.disconnect.hangup event in Revision 0 or a connection.disconnect.hangup event in Revision 1 or later. Catch the appropriate event to perform post-hang-up processing. Post-hang-up processing is limited to 5 seconds. Your event handler can use a data element to post data from your application to your Web server.
If the Tellme VoiceXML interpreter encounters a disconnect element within a telephone.disconnect.hangup or connection.disconnect.hangup event handler, the interpreter will not throw another telephone.disconnect.hangup or connection.disconnect.hangup event.
The namelist attribute can be used to return variables to the interpreter context. Currently, the Tellme interpreter context does not perform any processing on the variables. 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 requests a password from the user. If the user says "Tuesday", the application proceeds to the access_granted dialog. The first two times the user says nothing, she is played a message and reprompted. The third time the user says nothing, she is disconnected. If the user says something other than Tuesday, a retry counter, iRetries, is incremented. The third time the user says something other than Tuesday, she is played a fatal error message and is disconnected. To centralize the handling of an invalid password, both the nomatch handler and the filled handler throw a custom event, event.password.invalid.

<?xml version="1.0"?>
<vxml version="2.1"
<var name="iMaxTries" expr="3"/> <!-- max allowed password tries -->

<form id="get_password">
   <var name="iTries" expr="0"/>
   <var name="hint" expr="'It is a day of the week.'"/>
   <var name="fatal" 
      expr="'We are having technical difficulties validating your credentials. Try back later.'"/>

 <catch event="event.password.invalid">
   <!-- increment the attempt counter; if the count is exceeded, disconnect -->
   <assign name="iTries" expr="iTries+1"/>
   <if cond="iMaxTries == iTries">
     <value expr="fatal"/>
        clear is unnecessary on a nomatch, 
        but we use the same code to handle a bad filled
      <clear namelist="password"/>

 <field name="password">
     What is the code word?

   <grammar src="dow-voice.grxml" mode="voice" type="application/srgs+xml"/>
   <grammar src="dow-dtmf.grxml" mode="dtmf" type="application/srgs+xml"/>

   <help><value expr="hint"/></help>

   <!-- exec this on the first and second noinput/nomatch -->
   <!-- each event has its own counter -->
   <catch event="noinput">
     I'm sorry. I didn't hear you.
     <reprompt />

   <!-- exec this on the third nomatch -->
   <catch event="nomatch">
      <throw event="event.password.invalid"/>

   <!-- silently disconnect on the third noinput -->
   <catch event="noinput" count="3">

   <if cond="'tuesday' == password">
       <value expr="password"/> is correct!
       <goto next="#access_granted"/>
       <throw event="event.password.invalid"/>

  <form id="access_granted">
       <!-- we go home here; a *real* app would proceed via goto or submit -->
       <exit />     

[24]7 Inc.| Terms of Service| Privacy Policy| General Disclaimers