Page 1 of 1

After the caller has hung up, is there any way for me to per

Posted: Wed Jun 11, 2003 4:13 pm
by support
Use <catch> to trap the disconnect by catching the connection.disconnect event. For example:

Code: Select all

<catch event="connection.disconnect">
  <!-- clean up -->
  <submit next="close_session.php" namelist="session_id"/>
</catch>
This could be used to call the server script close_session.php to clean up and close session information on the server.

Note that any script called within a disconnect handler using catch must return valid VoiceXML or you run the risk of creating an infinite loop, since a fetch error also throws a connection.disconnect event.

Your clean-up script could return simply this:

Code: Select all

<?xml version="1.0"?>
<vxml version="2.0">
<form>
  <block>
    <exit/>
  </block>
</form>
</vxml>
Note that if your application uses several different VoiceXML pages, you can put the disconnect <catch> in the application root document so that it is active globally rather than reproduce the handler in each page.