Skip to main content

$dialer.bargeInInterrupt

This method determines the bot behavior during conditional barge-in.

caution
The method should only be called from the conditional barge-in event (bargeInIntent) handler.

Syntax

The method accepts a Boolean value (true or false) as its argument.

  • Passing true means that the barge-in condition is satisfied. Once the bargeInIntent handler execution is finished, the bot will interrupt to process the request.
  • If false is passed instead, the barge-in condition is not satisfied. No interruption will take place, and the bot will process the request only after its own reactions in the current state.
tip
The behavior when $dialer.bargeInInterrupt is not called from the bargeInIntent handler at all is the same as when it is called with false.

How to use

This method is used together with $dialer.getBargeInIntentStatus in order to determine the behavior when the client makes a barge-in attempt.

If the client says a phrase which bears meaning in the current context, $dialer.bargeInInterrupt is called and passed true, so that interruption takes place. Otherwise, the barge-in attempt should be ignored so that request processing is delayed until after the bot has finished its reply.

state: BargeInIntent
event: bargeInIntent
script:
var text = $dialer.getBargeInIntentStatus().text;

if (text.indexOf("human") > -1) {
$dialer.bargeInInterrupt(true);
}