We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

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

Answers to common Plum DEV questions

Moderators: admin, support

Locked
support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

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

Post 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.

Locked