Telefol Event Specification

The Event object defines the words and phrases the Telefol system will recognize and the conditions in which the system will trigger a response. Those conditions may be as simple as any time a given word is said, or complex queries based on the timing of a phrase or its proximity to other phrases. An Event may also be triggered if a phrase is not detected in a given time range.

phrases

One or more pairs of phrase and confidence

  • phrase - the word or consecutive words to recognize. The same phrase may not be specified multiple times; use the count parameter in order to trigger on multiple utterances of the same phrase. Repeating a phrase does not cause an error, but only the final instance of the repeated phrase will be used.
  • confidence - how likely it is that the specified word was actually said.
    Words that were said indistinctly or that sound similar to other words may be recognized with lower confidence. This parameter specifies the lowest confidence value that should be considered a match. 1000 is the highest possible confidence.

type

The event type determines the conditions under which an event will be triggered for the specified phrases.

  • Appear - phrase(s) can occur anywhere within the audio

  • Not - phrase(s) do not occur anywhere within the audio

    Optional parameter:

    • length - number of seconds after the beginning of the audio during which the phrase(s) should not appear
  • First - phrase(s) occur within length seconds of the beginning of the audio

    Required parameter:

    • length - number of seconds after the beginning of the audio during which the phrase(s) should appear
  • Bounds - phrase(s) occur within a specified range of the audio

    Required Parameters:

    • start - start time (in seconds) from the beginning of the audio stream
    • length - number of seconds after start during which the phrase(s) should appear
  • Within - specified phrases occur within a certain number of seconds of each other. Requires that at least 2 distinct phrases are specified.

    Required Parameter:

    • length - number of seconds to allow from the start of the one phrase during which the other phrase(s) should appear
  • Not_within - phrases do not occur within length seconds of each other

    Required Parameter:

    • length - number of seconds from the start of one phrase during which the other phrase(s) should not appear

find_notification

  • any - trigger an event as soon as any of the specified phrases occur. “Appear, Any, apple, banana” is equivalent to “match audio that contains apple or banana” so the sentence “I want to eat an apple” will match.
  • all - trigger an event after all the specified phrases occur. “Appear, All apple, banana” is equivalent to “match audio that contains apple and banana” so the sentence “I want to eat an apple” will not match.

Note that for most events all will trigger in fewer cases than any, but for not and not_within events, the reverse is true. For example, “Not, Any, apple, banana” is equivalent to “match audio that contains neither apple nor banana” (i.e. NOT(A OR B) ) so the sentence “I want to eat an apple” will not match.

Not, All, apple, banana” is equivalent to “match audio that does not include apple and banana” (i.e. NOT(A AND B) ) so the sentence “I want to eat an apple” will match.

count

Phrase or phrases must appear at least this many times before the event is triggered. Once count is exceeded, each successive matching phrase will trigger another event.

For example, “Appear, Any, apple, banana, carrot, count=3” will trigger 6 times on the utterance “apple, apple, carrot, banana, banana, carrot, apple, apple”–first on “carrot” since that’s when there have first been 3 matching phrases, then again on each subsequent matching word. “Appear, All, apple, banana, carrot, count=2” will trigger only once after it gets to the last “carrot” since that’s when it first has seen all of the phrases at least 2 times each. It does not trigger again for the final “apples” because it has not seen all the matching phrases again.

minimum_seconds_between

If specified, after an event has been triggered, don’t trigger another event for the same call until this many seconds have passed.

notification_limit

If specified, stop triggering events on any given call after this many have already been triggered.

evaluate_on

  • connect - Start evaluating this rule as soon as the audio begins
  • Unique name of another event - Start listening for these phrases after another event has already triggered. Use this option to chain rules together

participant

  • agent - Phrase(s) detected on the agent’s channel (channel 0 of the stereo stream)
  • client - Phrase(s) detected on the customer’s channel (channel 1 of the stereo stream)
  • both - Phrase(s) detected on either channel

metadata

Allows filtering based on arbitrary data associated with an audio stream. See the API documentation for details.

Examples

Find all calls in which the agent does not say “Thank you for calling” or “Thanks for calling” in the first 10 seconds

{
  name: "Missing Greeting", 
  description: "Agent does not start the call with thank you for calling",
  evaluate_on: "connect",
  participant: "agent",
  detection_language: "en_US",
  phrase_config:
  {
    find_notification: "any",
    appearance:
    {
      type: "not",
      length: 10
    },
    phrases:
    [ 
      {
        phrase: "thank you for calling",
        confidence: 800
      }, 
      {
        phrase: "thanks for calling",
        confidence: 800
      }
    ]
  }
}

Find all audio in which the customer asks for a supervisor or manager more than once

{
  name: "Escalation", 
  description: "Customer makes multiple requests to speak with the agent's superior",
  evaluate_on: "connect",
  participant: "client",
  detection_language: "en_US",
  phrase_config:
  {
    find_notification: "any",
    appearance:
    {
      type: "appear"
    },
    phrases:
    [ 
      {
        phrase: "your manager",
        confidence: 800
      }, 
      {
        phrase: "your supervisor",
        confidence: 800
      }
    ]
  },
  count: 2
}

Find all audio in which either party seems to mention a money-back guarantee

Since there might be multiple ways in which someone might say it–e.g. “Do you guarantee I’ll get my money back?” or “we’ll return your money, guaranteed”–just look for the key words “money” and “guarantee” within 10 seconds of each other. The event will trigger regardless of the order in which the phrases are said.

{
  name: "Guarantee", 
  description: "Either party says money and guarantee close together",
  evaluate_on: "connect",
  participant: "both",
  detection_language: "en_US",
  phrase_config:
  {
    find_notification: "all",
    appearance:
    {
      type: "within",
      length: 10
    },
    phrases:
    [ 
      {
        phrase: "money",
        confidence: 800
      }, 
      {
        phrase: "guarantee",
        confidence: 800
      }
    ]
  }
}