Service enfonica.voice.v1beta1.Streams¶
Methods¶
StreamCall |
---|
rpc StreamCall(stream StreamCallRequest) returns (stream StreamCallResponse) Operates a stream which can be bridged to by a call. This allows bi-directional audio to be passed. This method is only available via the gRPC API (not REST). If the stream is not connected to a call within 30 seconds of establishment, this method will fail. |
StreamCallRequest¶
The top-level message sent by the client to the [StreamCall][enfonica.voice.v1beta1.Streams.StreamCall] method.
The first message must contain [setup][enfonica.voice.v1beta1.StreamCallRequest.setup] which sets the stream resource name and the audio configuration of the stream. The stream resource name should then be supplied to the VoiceML <Stream>
action to connect a call to the stream.
Fields | |
---|---|
setup | StreamSetup The configuration of the stream. This must be specified in the first message in the request stream. It should not be specified in subsequent messages, however if it is, it will be ignored. |
input_audio | InputAudio The input audio to play to the call. Input audio will be bufferred by the stream, unless [clear][enfonica.voice.v1beta1.InputAudio.clear] is true, in which case the buffer will be cleared and replaced with the specified audio. The size of the input buffer is limited to 1 minute. Audio specified beyond this limit will be truncated. |
update_request_parameters | UpdateRequestParameters Updates the request parameters of the subsequent VoiceML request once this stream has completed. This allows you to pass values to your VoiceML handler. Parameters specified in this message will be merged with any previous parameters that were specified. |
InputAudio¶
Represents audio content supplied by the API caller and played to the call.
Fields | |
---|---|
config | AudioConfig The configuration of the audio content. * If config is omitted, the audio configuration from the initial stream setup will be used. * If config is specified, it will be used, and if different to the audio configuration from the initial stream setup, the audio content will be transcoded. |
audio | bytes The audio content encoded as per the audio configuration. The maximum length of audio specified in one message is 960,000 bytes. |
clear | boolean If true, clears all previously bufferred audio. |
StreamSetup¶
Setup message to configure the stream.
Fields | |
---|---|
stream | string The name of the stream. Format: projects/<Project ID>/streams/<Stream ID> . It's up to the API caller to choose an appropriate Stream ID . It must be unique and the length of Stream ID must not exceed 36 characters. |
audio_config | AudioConfig The audio configuration of the stream. This will be used for both input and output audio. |
UpdateRequestParameters¶
Message to update the request parameters in the subsequent VoiceML request once the stream has completed.
Fields | |
---|---|
parameters | map<string, string> The request parameters to merge. The maximum aggregate size of all persisted keys and values is 50 KiB. |
AudioConfig¶
Description of the format of audio content.
Fields | |
---|---|
audio_encoding | AudioEncoding Required. Required. Audio encoding of the audio content. |
sample_rate_hertz | int32 Sample rate (in Hertz) of the audio content. |
AudioEncoding¶
Audio encoding of audio content.
Enums | |
---|---|
AUDIO_ENCODING_UNSPECIFIED | Not specified. |
AUDIO_ENCODING_MULAW | 8-bit samples that compand 14-bit audio samples using G.711 PCMU/mu-law. Only supports 8000Hz sample rate. |
AUDIO_ENCODING_ALAW | 8-bit samples that compand 14-bit audio samples using G.711 PCMA/a-law. Only supports 8000Hz sample rate. |
StreamCallResponse¶
The top-level message returned from the [StreamCall][enfonica.voice.v1beta1.Streams.StreamCall] method.
Multiple response messages can be returned. The first response message will always have [call_connected][enfonica.voice.v1beta1.StreamCallResponse.call_connected] set, indicating that the stream has been connected to a call.
If the call is disconnected, the response stream will be closed.
Fields | |
---|---|
call_connected | CallConnectedEvent If set, the call has been connected to the stream. This will always be the first event in the response stream. |
output_audio | OutputAudioEvent The audio received from the call. The stream will buffer the audio and send it in chunks. There is no specific size defined for each chunk, but it should be roughly in the range of 1000 to 2000 bytes. |
input_audio_buffer_empty | InputAudioBufferEmptyEvent Indicates that the input audio specified to be played to the call has completed and the stream's buffer is empty. |
CallConnectedEvent¶
Event indicating a call has been connected to the stream.
Fields | |
---|---|
call | string The resource name of the call that has been connected to the stream. |
InputAudioBufferEmptyEvent¶
Event indicating that the input audio has completed playing to the call.
This type has no fields.
OutputAudioEvent¶
Event containing audio from the stream.
Fields | |
---|---|
audio | bytes The audio content encoded as per the audio configuration requested during the initial stream setup. |