Skip to main content

Start Transcription

The StartTranscription verb allows a segment of a call to be transcribed, and optionally for the live transcription to be sent off to another destination for additional processing. The transcription will continue until the call ends or the <StopTranscription> verb is used. When a destination is specified, live transcription updates for one or both sides (tracks) of the call will be sent to the specified destination. A total of 4 concurrent track transcriptions are allowed on a call. A <StartTranscription> request that uses both tracks will count as 2 of the permitted 4 concurrent track transcriptions.

A call has only two tracks, which are named after the direction of the media from the perspective of the Programmable Voice platform:

  • inbound: media received by Programmable Voice from the call executing the BXML;
  • outbound: media sent by Programmable Voice to the call executing the BXML.

Note that this has no correlation to the direction of the call itself. For example, if either an inbound or outbound call is being transcribed and executes a <SpeakSentence>, the inbound track will be the callee's audio and the outbound track will be the text-to-speech audio.

Text Content

There is no text content available to be set for the <StartTranscription> verb.

Attributes

AttributeDescription
name(optional) A name to refer to this transcription by. Used when sending <StopTranscription>. If not provided, it will default to the generated transcription id as sent in the Real-Time Transcription Started webhook.
tracks(optional) The part of the call to send a transcription from. inbound, outbound or both. Default is inbound.
transcriptionEventUrl(optional) URL to send the associated Webhook events to during this real-time transcription's lifetime. Does not accept BXML. May be a relative URL.
transcriptionEventMethod(optional) The HTTP method to use for the request to transcriptionEventUrl. GET or POST. Default value is POST.
username(optional) The username to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
password(optional) The password to send in the HTTP request to transcriptionEventUrl. If specified, the transcriptionEventUrl must be TLS-encrypted (i.e., https).
destination(optional) A websocket URI to send the transcription to. A transcription of the specified tracks will be sent via websocket to this URL as a series of JSON messages. See below for more details on the websocket packet format.
stabilized(optional) Whether to send transcription update events to the specified destination only after they have become stable. Requires destination. Defaults to true.

If the destination and transcriptionEventUrl attributes are specified, then the Real-Time Transcription Started, Real-Time Transcription Rejected and Real-Time Transcription Stopped events will be sent to the URL when the transcription starts, if there is an error starting the transcription and when the transcription ends respectively. BXML returned in response to this callback will be ignored. If the transcriptionEventUrl attribute is specified, then the Real-Time Transcription Available event will be sent once the transcription has ended providing a URL from where the transcription can be downloaded. BXML returned in response to this callback will be ignored.

note

While multiple real-time transcriptions for the same call are allowed, each real-time transcription MUST have a unique name. Attempting to start a real-time transcription on the same call with the name of an already existing real-time transcription will result in a Real-Time Transcription Rejected event.

Webhooks Received

WebhooksCan reply with more BXML
Real-Time Transcription StartedNo
Real-Time Transcription RejectedNo
Real-Time Transcription StoppedNo
Real-Time Transcription AvailableNo

Nested Tags

You may specify up to 12 <CustomParam/> elements nested within a <StartTranscription> tag. These elements define optional user specified parameters that will be sent to the destination URL when the real-time transcription is first started.

CustomParam Attributes

AttributeDescription
name(required) The name of this parameter, up to 256 characters.
value(required) The value of this parameter, up to 2048 characters.

Websocket Packet Format

If a destination is specified, it will be sent JSON messages for the duration of the real-time transcription. There will be an initial start message when the connection is first established. This will be followed by zero or more transcription messages containing transcription updates for the tracks being transcribed. Finally, when a real-time transcription is stopped, a stop message will be sent.

Start and Stop Message Parameters

ParameterDescription
eventTypeWhat type of message this is, one of start, or stop
metadataDetails about the real-time transcription this message is for. See further details below.
customParams(optional) (start message only) If any <CustomParam/> elements were specified in the <StartTranscription> request, they will be copied here as a map of name : value pairs

Metadata Parameters

ParameterDescription
accountIdThe user account associated with the call
callIdThe call id associated with the real-time transcription
realTimeTranscriptionIdThe unique id of the real-time transcription
transcriptionNameThe user supplied name of the real-time transcription
tracksA list of one or more tracks being transcribed in real-time
tracks.nameThe name of the track being transcribed, will be used to identify which transcription updates belong to which track
stabilizedWhether transcription updates will be sent only after they have become stable or not

Transcription Message Parameters

ParameterDescription
eventTypeWill always be transcription
trackThe name of the track this transcription update is for, will be one of the names specified in the start message
startTimeThe time at which this segment started
endTimeThe time at which this segment ended
isPartialIndicates if the segment is complete
languageThe detected language of the segment
transcriptThe transcription of this segment as a flattened string
itemsThe list of items making up this segment
items.contentA word or punctuation
items.startTimeThe time at which this item started
items.endTimeThe time at which this item ended
items.confidenceThe confidence score associated with a word or phrase in your transcript.
items.stableIndicates whether the specified item is stable (true) or if it may change when the segment is complete (false).
items.typeEither PRONUNCIATION or PUNCTUATION

Examples

Transcribe an Active Call

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<SpeakSentence voice="bridget">This call is being streamed to a live studio audience and transcribed.</SpeakSentence>
<StartTranscription name="live_audience" tracks="both" destination="wss://live-studio-audience.myapp.example.com" transcriptionEventUrl="https://myapp.example.com/noBXML">
<CustomParam name="custom_param_1" value="value_1"/>
<CustomParam name="custom_param_2" value="value_2"/>
</StartTranscription>
</Response>

A start Websocket Message

{
"eventType": "start",
"metadata": {
"accountId": "5555555",
"callId": "c-2a913f94-7fa91773-a426-4118-8b8b-b691ab0a0ae1",
"realTimeTranscriptionId": "s-2a913f94-93e372e2-60da-4c89-beb0-0d3a219b287c",
"transcriptionName": "live_audience",
"tracks": [
{
"name": "inbound"
},
{
"name": "outbound"
}
]
},
"customParams": {
"foo": "bar",
"foos": "bars"
}
}

A transcription Websocket Message

{
"eventType": "transcription",
"track": "inbound",
"startTime": "2023-03-31T20:05.101Z",
"endTime": "2023-03-31T20:07.493Z",
"isPartial": false,
"language": "en-US",
"transcript": "hello world!",
"items": [
{
"content": "hello",
"startTime": "2023-03-31T20:05.101Z",
"endTime": "2023-03-31T20:06.285Z",
"confidence": 0.9,
"stable": true,
"type": "PRONUNCIATION"
},
{
"content": "world",
"startTime": "2023-03-31T20:06.984Z",
"endTime": "2023-03-31T20:07.493Z",
"confidence": 0.6,
"stable": true,
"type": "PRONUNCIATION"
},
{
"content": "!",
"startTime": "2023-03-31T20:07.493Z",
"endTime": "2023-03-31T20:07.493Z",
"confidence": 0.9,
"stable": false,
"type": "PUNCTUATION"
}
]
}

A stop Websocket Message

{
"eventType": "stop",
"metadata": {
"accountId": "5555555",
"callId": "c-2a913f94-7fa91773-a426-4118-8b8b-b691ab0a0ae1",
"realTimeTranscriptionId": "s-2a913f94-93e372e2-60da-4c89-beb0-0d3a219b287c",
"transcriptionName": "live_audience",
"tracks": [
{
"name": "inbound"
},
{
"name": "outbound"
}
]
}
}