<Error/>

Error Handling with <Error/> Command

The <Error/> command provides a way to handle situations where a call is unable to proceed as intended. This command can be included within any other command, and its enclosed actions will be executed if the parent command's success parameter is set to false.

Examples:

Simple Example:

xmlCopy code<Error>
  <!-- Speak a message -->
  <Say>Try again later</Say>

  <!-- End the call -->
  <Hangup/>
</Error>

In this example, if the preceding command encounters an error (success = false), the <Say> command will vocalize a message, and the call will be hung up.

Play Error Reason:

xmlCopy code<!-- Play error reason to the channel -->
<Error play="true"/>

<!-- Play error reason and hang up -->
<Error play="true">
  <Hangup/>
</Error>

The play attribute, when set to true, instructs Opentact to articulate the error reason to the caller. The additional <Hangup/> command ensures the call is terminated after providing the error details.

Attributes:

  • tag (string):

    • Notification event tag used to mark call notification events (if configured).

  • say (boolean, default: false):

    • If set to true, Opentact will vocalize the error reason to the channel.

The <Error/> command allows you to gracefully manage error scenarios, providing information to callers and taking appropriate actions, such as playing a message or hanging up the call.

Last updated