Overview

Interpret translates the speech of a call of a two party connect in real time. An interpretation is one call: the speech of that call is recognized (speech-to-text), translated, and played to the other party in peer_language (text-to-speech). To interpret both parties, run one interpretation for each call.

Note

AI Implementation Hint

Interpret works only on a two party call: a call that is joined to another call by the connect action or by a queue. A conference call is rejected. Start it with POST /interprets (one call per request), or with the interpret_* options of the connect action (one interpretation for each side, see interpret_speakers), or with the interpret_start action (the call of the activeflow only).

How it works

caller (en-US)                    VoIPBin                         callee (es-ES)
     |  "Hello"                      |                                  |
     |------------------------------>| speech-to-text  -> "Hello"       |
     |                               | translate       -> "Hola"        |
     |                               | text-to-speech  -> audio         |
     |                               |--------------------------------->|  "Hola"
  • One interpretation is one call. It never touches the media of the other call: call_id is the interpreted call and peer_call_id is only a reference to the other call.

  • The original voice of the interpreted call is silenced for the other party by default. With keep_original_audio set to true it stays audible but is attenuated by original_attenuation_db (default 12 dB, range 6 to 40).

  • The interpreted voice is played only to the other party. The original voice of a call stays at full level in the recording of that call itself.

  • Utterances are interpreted in order. When the translated audio of earlier utterances is still playing, a new utterance waits in a queue. An utterance that would delay the conversation by more than about 20 seconds is dropped and recorded as failed.

  • A translation that repeats what the listener just heard (echo) is ignored. The echo suppression works only when the two interpretations are a matching pair: language of one is peer_language of the other. With a mismatched pair each interpretation still runs as configured, but the echo is not detected.

Ways to start

  • POST /interprets on a call that is already connected to another call. It interprets only call_id. To interpret the other party too, send a second request with the other call and the swapped languages.

  • interpret_* options of the connect action: the interpretations start when the connected call answers. interpret_speakers selects the calls: both (default), origin (the call that runs the connect) or peer (the connected call). The languages are swapped for the connected call automatically, so the pair always matches. A wrong option, including an unknown interpret_speakers value, never fails the connect. The call is connected without the interpretation and an interpretation with status failed is recorded.

  • The interpret_start action, for a flow that already runs on a connected call. It interprets the call of the activeflow only. See interpret_start.

An interpretation ends when it is stopped (POST /interprets/{id}/stop or the interpret_stop action, which stops the interpretation of the call of the activeflow only), when its call or the other call of the connect hangs up, when the call is no longer a two party connect, or when it fails repeatedly. The two interpretations of one connect are independent in start and in failure; a connect that is no longer a two party call ends both.

Supported languages

en-US, en-GB, es-ES, fr-FR, de-DE, it-IT, pt-BR, ja-JP, ko-KR, zh-CN. language and peer_language of an interpretation must differ. The recognition quality of a language depends on the speech-to-text provider.

Voice and provider

provider selects the text-to-speech provider (elevenlabs, gcp or aws). peer_voice_id is the voice that the other party hears, spoken in peer_language. The voice id values depend on the provider. If omitted, the platform defaults are used.

An interpretation has exactly one voice. It reads the translation of the speech of its own call to the other party. The voice that you hear when the other party talks belongs to the interpretation of the other call. The voice fields are named after the listener, not the speaker:

Field

Who hears it

What it reads

peer_voice_id (POST /interprets, interpret_start)

The other party

The translation of the speech of call_id (the call of the activeflow for interpret_start), in peer_language

interpret_peer_voice_id (connect)

The connected call

The translation of the speech of the call that runs the connect, in interpret_peer_language

interpret_origin_voice_id (connect)

The call that runs the connect

The translation of the speech of the connected call, in interpret_origin_language

The two voices of a connect are spoken in different languages, so they are usually different voices. When provider is gcp, the voice id must start with the language that the listener hears followed by a hyphen (for example es-ES-... when the listener hears es-ES). Otherwise POST /interprets is rejected with INVALID_VOICE, interpret_start fails and the flow continues, and a connect is connected without that interpretation and records it with status failed.

Latency

The interpreted voice starts about 2 to 4 seconds after the speaker stops talking. The time grows with the length of the utterance.

Limits and billing

  • The number of concurrent interpretations per customer is limited. An interpretation is one call, so a two party connect with both sides interpreted counts as two. The request is rejected with 429 above the limit.

  • Utterances are stored as customer content (speech_text and translated_text) and removed by DELETE /interprets/{id}.

  • The session reports translate_in_chars, translate_out_chars and tts_chars for usage.

  • The recognized speech and its translation are sent to external translation and text-to-speech providers.

Events

The interpret_created, interpret_ended and interpret_deleted events carry the Interpret. The interpret_utterance_created event carries the Utterance, and interpret_utterance_failed is published when an utterance could not be interpreted. It carries the failed stage and, for a translation failure, an error class (see Utterance failed).