Post-call processing after hangup

When a caller hangs up while an application is still executing, this disrupts the normal flow of the call. However, Voice Platform throws two events that you can catch with a <catch> element in order to perform post-call cleanup:

  • First, the VoiceXML document currently being executed throws a VoiceXML-standard connection.disconnect.hangup event.
  • If more than one application was involved in the call, Voice Platform also throws a nuance.sessionended event in every root document that was loaded. This event can be used to trigger cleanup in all applications that were executed earlier on in the call.

For example, the following instructions could write information to the log after a hangup:

<catch event="connection.disconnect.hangup">
    <script>
        updateCallOutcomeReason('PARTIAL_COMPLETE', 'HANGUP');
        </script>
    <submit next="EndCall.vxml"/>
</catch>

The semantics of the nuance.sessionended event are the same as those of the standard disconnect: execution proceeds until an <exit> is reached or a <form> runs out of form items to execute. Then the next application in the chain is processed, and so on.

If no post-call cleanup is required, refrain from providing <catch> handlers for connection.disconnect.hangup and nuance.sessionended events. This allows Voice Platform to perform an immediate <exit> and prepare for the next call as quickly as possible.

For details on these events, see Event types.

Note: Voice Platform is unable to take new calls on the same port while waiting for applications to finish their post-hangup processing. By default, Voice Platform expects applications to clean up quickly after a hangup. If post-hangup processing for your application takes too much time, Voice Platform generates an alarm. To avoid generating such an alarm unnecessarily (for example, if this delay is actually expected behavior for your application), you can adjust the browser.maxAppPostCallProcessingSecs service property to an appropriate value.