Skip to main content

$dialer.bargeInResponse

This method enables barge-in for the current request and configures its settings.

Syntax

The method accepts an object with the following properties.

bargeIn

bargeIn is the barge-in mode. The following values are allowed:

  • disabled — barge-in is disabled.
  • forced — when receiving barge-in input, the bot is interrupted immediately, stopping in the middle of its reply.
  • phrase — when receiving barge-in input, the bot finishes its last reply and is then interrupted.

bargeInTrigger

bargeInTrigger is the event which triggers the barge-in. The following values are allowed:

  • final — barge-in occurs when the ASR provider returns the final speech recognition result.
  • interim — barge-in occurs when any intermediate result is returned by the ASR provider, even when it is incomplete.
caution
Units treated as intermediate ASR results may vary depending on which ASR provider is used: for example, it may be a single word or a single syllable pronounced by the customer.

noInterruptTime

noInterruptTime is the time after the bot has started its first reply during which it cannot be interrupted, in milliseconds.

  • If a barge-in trigger occurs during noInterruptTime, the bot will be interrupted immediately after the set interval ends.
  • If noInterruptTime is set to zero, barge-in can be triggered at any time after the bot begins its reply.
$dialer.bargeInResponse({
bargeIn: "phrase",
bargeInTrigger: "final",
noInterruptTime: 0
});

How to use

Note that $dialer.bargeInResponse enables barge-in only for the state where it is called from. To enable barge-in for all states existing in the script, call it from a handler such as postProcess:

bind("postProcess", function($context) {
$dialer.bargeInResponse({
bargeIn: "forced",
bargeInTrigger: "interim",
noInterruptTime: 2000
});
});