recognize@v3

Recognize voice - Speech-to-Text.

Versionrecognize@v3
Runs ininbound-call and your own branches

Parameters

NameTypeRequiredDefaultDescription
languageaf-ZA, am-ET, ar-AE… (140 values)Speech-to-text language (the prompt language is tts.language or tts.voice). See Voices & Audio
accepts ${{ }}
timeoutnumber101..60 · accepts ${{ }}
ttsobjectText-to-speech prompt: text (1 to 1024 characters), with an optional voice or language (exclusive). Without them, the defaults of the branch or of the scenario apply. text-to-speech prompt: text, and voice or language
audioFileobjectAn audio file of your library, by its SID (REST API v2 identifier). audio file of your library: sid
hintsarray of string1..10 items
stopOnDTMFbooleanfalseaccepts ${{ }}

Every parameter that accepts ${{ }} can be computed from an expression.

Examples

Same as recognize@v2, with the same prompt parameters as play@v3

tts (text-to-speech) or audioFile (audio file of your library). Set at most one of them: without any, the action only listens. The prompt is interrupted by the first final recognition result, or by a key press with stopOnDTMF. The timeout covers the prompt and the listening: use a timeout longer than your audio file.

- label: ask
  action: recognize@v3
  params:
    tts:
      text: Are you looking for a house, a car or a parking lot?
    hints:
      - A house
      - A car
      - A parking lot
  result: $type

With an audio file of your library (SID: REST API v2 identifier, see https://docs.callr.com/reference/audiofilesget)

- action: recognize@v3
  params:
    audioFile:
      sid: 'fdsanjkf'
    hints: [support, commercial]
    language: fr-FR
  result: $department

Full example with defaults

- action: recognize@v3
  params:
    tts: # or audioFile: { sid: 'fdsanjkf' }, or none
      text: How can I help you? # (1..1024 characters)
      # voice: en-US-AvaMultilingual # or language: en-US (default: the language below)
    # language: en-US # stt language (default: the scenario defaults)
    timeout: 10
    stopOnDTMF: false
    hints: [support, sales] # helps the recognition (none by default)

Using the result

- if: '!$type.ok'
  then:
    - action: play@v3
      params:
        tts:
          text: Sorry, I did not get that
    - goto:
        label: ask

- action: play@v3
  params:
    tts:
      text: You said ${{ $type.lexical }}!

Result

Set result: $myVariable to keep it. Result of recognize@v2 and recognize@v3 (speech-to-text)

FieldTypeDescription
okbooleantrue when speech was recognized (or when a key stopped the recognition)
timeoutbooleantrue when nothing was recognized in time
errorstringOnly present on error: hangup when the caller hung up, canceled, or the error message
textstringRecognized text, formatted with punctuation
lexicalstringRecognized text, as words (no punctuation, numbers spelled out)
itnstringInverse Text Normalization (ITN), numbers as digits
maskedITNstringITN with profanity masked
confidencenumberConfidence of the recognition (0 to 1)
offsetnumberStart of the recognized speech, in seconds
durationnumberDuration of the recognized speech, in seconds
wordsarray or nullRecognized words, null when nothing was recognized
stoppedOnDTMFbooleantrue when a key pressed by the caller stopped the recognition (stopOnDTMF)
dtmfstringKey pressed when stoppedOnDTMF is true, empty otherwise
{
  "ok": true,
  "timeout": false,
  "text": "A house.",
  "lexical": "a house",
  "itn": "a house",
  "maskedITN": "a house",
  "confidence": 0.9,
  "offset": 2.08,
  "duration": 0.6,
  "words": [
    {
      "word": "a",
      "offset": 2.08,
      "duration": 0.2,
      "confidence": 0.88
    },
    {
      "word": "house",
      "offset": 2.4,
      "duration": 0.4,
      "confidence": 0.92
    }
  ],
  "stoppedOnDTMF": false,
  "dtmf": ""
}

Older versions

Older versions keep working in existing scenarios. Use the version above in new scenarios.

  • recognize@v2: Recognize voice - Speech-to-Text
  • recognize@v1: Use recognize@v2 instead recognize@v1 is deprecated, use recognize@v3

Did this page help you?