Skip to main content

$dialer.getBargeInIntentStatus

This method allows obtaining the data on conditional barge-in from the script.

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

Syntax

The method is called without arguments and returns and object with two string properties:

  • bargeInIf — conditional barge-in label.
  • text — the text of the barge-in attempt request.
$dialer.getBargeInIntentStatus(); // => Example: {bargeInIf: "OfferNotDone", text: "hold on"}

How to use

Based on the information on the barge-in label and text, the bargeInIntent event handler determines whether the bot should interrupt. If the barge-in condition is satisfied, the handler should call $dialer.bargeInInterrupt and pass true as its argument.

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

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