VoiceXML 2.1 Development Guide Home  |  Frameset Home

  Outbound Transfer Basics  |  TOC  |  Transfer Exceptions  

Disconnect Events

While the different Nuance VWS browsers each have their own specific syntaxes for catching and handling disconnect events, the Motorola browser simplifies things by sticking close to the specification, and the main event that should be trapped for disconnect notifications should be connection.disconnect.hangup event. You could also catch this event by using the prefixed error name of connection.disconnect, but most developers prefer the finer-grained error handling when using the specific syntax.

When either of these events get thrown, it is essentially telling the application that it detected a hangup, either from the caller, or the callee,(if no other handlers are in place within the <transfer> itself), in the case of an outbound calling application, or lastly, if the application executes the <disconnect> event.


When catching disconnect events, remember these very important points:The <disconnect> element will throw an error.telephone.disconnect' event, while the <exit> element will not throw this event. Make certain you know the difference when coding your application.

The second thing to keep in mind is that the actual disconnect event itself is very different on the Nuance VWS 1.3 platform. Using VWS1.3, we would catch a disconnect event like so:


    <catch event="telephone.disconnect">
      <log expr="'CAUGHT THE TELEPHONE.DISCO'"/>
      <exit/>
    </catch>


However, in the Motorola and Nuance VWS2.0 environment, you will instead need to catch the updated disconnect event:


    <catch event="connection.disconnect.hangup">
      <log expr="'CAUGHT THE CONNECTION.DISCO'"/>
      <exit/>
    </catch>



The other important caveat to the disconnect condition is that at least one voice recognition field absolutely must be present in order to successfully catch this event. If there is not an existing one, we can create a 'dummy' field with a 'garbage' grammar to allow this event to be properly caught:


WontWork.vxml


<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.0">

  <catch event="connection.disconnect.hangup">
    <submit next="MyCleanupPage.jsp"/>
    <exit/>
  </catch>

  <form>
    <block>
      <prompt>
        Thanks for calling, you may now hang up.
      </prompt>
    </block>
  </form>
</vxml>



WillWorkJustAsFineAsPaint.vxml


<?xml version="1.0" encoding="UTF-8"?>

<vxml version = "2.0" >


  <catch event="connection.disconnect.hangup">
    <log expr="'caught the disconnect'"/>
    <submit next="MyCleanupPage.jsp"/>

<!-- ALWAYS use an <exit> after catching a disconnect event -->
    <exit/>
  </catch>

  <form>
    <field name="dummy">

<!-- set the 'noinput' timeout to 1 second -->
      <property name="timeout" value="1s"/>

      <prompt>
        Thanks for calling, you may now hang up.
      </prompt>


<!-- create a 'garbage' grammar that will NEVER get a match -->
      <grammar type="text/gsl"> [poppaoomowmow] </grammar>

      <filled>
        <prompt>
          no way this will ever happen.
        </prompt>
      </filled>

      <noinput>
        <disconnect/>
      </noinput>

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


Clever readers will also note that there is an explicit </exit> within our catch handlers for the disconnect event. This is because, if a caller disconnects while an active voice reco field is listening for user input, then the W3C specification demands that the application immediately exit with an error.semantic event. While this is transparent to the user, it presents an ugly error getting thrown in the logger, resulting in confusion for the developer. Best practices dictate that after a disconnect event is thrown, caught, and handled, that the document should have an explicit <exit> element present to gracefully end the application, which will result in sidestepping this error event altogether. For more information on this particular behavior, and the specific error message details, see Appendix B in this documentation set.




  ANNOTATIONS: EXISTING POSTS
agonzalez
6/29/2006 4:23 AM (EDT)
in the WillWorkJustAsFineAsPaint.vxml after de log of the expression you use a submit tag without method and also without parameters it should be a goto also in the wont workt the same stuff thanks
agonzalez
6/29/2006 4:33 AM (EDT)
why to make the platform to install and evaluate a grammar it shouldnt be better a code as this?
------------------------------BOF----------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE vxml SYSTEM "../dtd/vxml.dtd">
<vxml xmlns="http://www.w3.org/2001/vxml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.w3.org/2001/vxml
http://www.w3.org/TR/voicexml21/vxml.xsd" version="2.1">
<catch/>
<meta name="maintainer" content="someone@somewhere.somedomain"/>
<form>
  <block>
    <prompt>
      Thanks for calling, you may now hang up.
    </prompt>
    <exit/>
  </block>
</form>
</vxml>
------------------------------EOF--------------------------
sorry this thing is said at:
http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=disconnect.htm
agonzalez
6/29/2006 4:43 AM (EDT)
well im developing a application that jumps between much .jsp files is there anyway to catch a "<catch event="connection.disconnect.hangup" scope="application"/>"or i have to include a catch in 26 files?
---------------------------------------------------------------
sorry for this its answered at:
http://docs.voxeo.com/voicexml/2.0/frame.jsp?page=vxml.htm
zscgeek
6/29/2006 9:37 AM (EDT)
Agonzalez,

As you saw if you put the <catch> in the application root document it will be active for the entire lifetime of your application. This is the way most people handle global scoped event handing.

If you need a more detailed example of this please just let us know and we can try to cook something up for you.

Regards,

    RJ
zmaqbool
2/15/2007 12:44 PM (EST)
Hi, I have an application scoped vxml file, which has the following code for catch event

code for appRoot.jsp

  <catch event="connection.disconnect.hangup">
    <submit next="diconnect.jsp"/>
    <exit/>
  </catch>

and in another vxml file, I have no reference, to this catch event, I have just included appRoot.jsp.

My Problem is that when i hang up the phone , while currently being on this page. Nothing happens... I mean it does not goto disconnect.jsp page at all..

I would be extremely thankful for helping me out.

Zahid
mikethompson
2/15/2007 3:25 PM (EST)
Hi Zahid,

Catching hangup events in VoiceXML can be a bit tricky at times, but not impossible by any means.  You need to ensure you are within an active recognition field in order to catch the hangup.  This is simply the way the VoiceXML FIA operates, but we can easily trick the platform into thinking we are in a recognition field all the time.  Check out this tutorial on disconnect events and I think you will learn a lot:

http://docs.voxeo.com/voicexml/2.0/mot_discoevents.htm

If you are still struggling to catch the hangup after making these changes, please open a private account ticket with us and we will be glad to help you.

Best,
Mike Thompson
Voxeo Corporation

login

  Outbound Transfer Basics  |  TOC  |  Transfer Exceptions  

© 2003-2008 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site