sinch.domains.voice.helpers.v2.svaml.recording module

class sinch.domains.voice.helpers.v2.svaml.recording.Recording[source]

Bases: object

Helpers to build the call recording SVAML commands.

static options(destination: ~typing.Literal['AWS', 'GCP', 'AZURE'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)], url: str, credentials: str, *, format: ~typing.Literal['MP3', 'WAV'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, recording_type: ~typing.Literal['COMBINED', 'INBOUND', 'OUTBOUND'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)] | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, transcription_options: ~sinch.domains.voice.models.v2.svaml.types.transcription_options_dict.TranscriptionOptionsDict | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>) → RecordingOptionsDict[source]

Recording options to store recordings in a third party storage.

Parameters:
  • destination (RecordingDestinationType) –

    Third party storage to deliver the recording to.

    • AWS: Amazon Web Services S3 bucket.

    • GCP: Google Cloud Platform Storage.

    • AZURE: Microsoft Azure Blob Storage.

  • url (str) – Destination URL for the recording. Use s3, gs or azure as schema for the URL, depending on the destination.

  • credentials (str) – Credentials to third party storage.

  • format (UnsetOr[RecordingFormatType]) –

    Audio format for this recording. Defaults to MP3.

    • MP3: MPEG Audio Layer III compressed audio format.

    • WAV: Waveform Audio File Format, uncompressed audio.

  • recording_type (UnsetOr[RecordingType]) –

    The type of recording to perform. Defaults to COMBINED.

    • COMBINED: Record inbound and outbound voice streams.

    • INBOUND: Record inbound voice stream only.

    • OUTBOUND: Record outbound voice stream only.

  • transcription_options (UnsetOr[TranscriptionOptionsDict]) – Configuration for automatic speech-to-text transcription of the recording: is_enabled (if true, the recording will be transcribed to text) and locale (language code in BCP-47 format, defaults to en-US).

Returns:

The recording options.

Return type:

RecordingOptionsDict

static start(
options: RecordingOptionsDict,
*,
name: str | Unset = <sinch.core.sentinel.Unset object>,
on_finish: AmdCommandDict | DialCommandDict | MessagesCommandDict | StopMessagesCommandDict | CustomEventCommandDict | HangupCommandDict | AnswerCommandDict | PauseCommandDict | StartRecordingCommandDict | StopRecordingCommandDict | BridgeCallCommandDict | MenuCommandDict | GotoMenuCommandDict | Sequence[AmdCommandDict | DialCommandDict | MessagesCommandDict | StopMessagesCommandDict | CustomEventCommandDict | HangupCommandDict | AnswerCommandDict | PauseCommandDict | StartRecordingCommandDict | StopRecordingCommandDict | BridgeCallCommandDict | MenuCommandDict | GotoMenuCommandDict] | Unset = <sinch.core.sentinel.Unset object>,
on_failure: AmdCommandDict | DialCommandDict | MessagesCommandDict | StopMessagesCommandDict | CustomEventCommandDict | HangupCommandDict | AnswerCommandDict | PauseCommandDict | StartRecordingCommandDict | StopRecordingCommandDict | BridgeCallCommandDict | MenuCommandDict | GotoMenuCommandDict | Sequence[AmdCommandDict | DialCommandDict | MessagesCommandDict | StopMessagesCommandDict | CustomEventCommandDict | HangupCommandDict | AnswerCommandDict | PauseCommandDict | StartRecordingCommandDict | StopRecordingCommandDict | BridgeCallCommandDict | MenuCommandDict | GotoMenuCommandDict] | Unset = <sinch.core.sentinel.Unset object>,
) → StartRecordingCommandDict[source]

Starts recording the call. This is a non-blocking command — execution continues to the next command in the sequence immediately after recording begins.

Parameters:
  • options (RecordingOptionsDict) – Recording options for this recording, built with options().

  • name (UnsetOr[str]) – Identifier for this recording within the session, between 1 and 32 characters, matching ^\S+$. Must be unique across active recordings in the session. Setting the recording name is useful for stopping the recording with stop(). If name is not set, recording can only be stopped when the call is disconnected.

  • on_finish (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – Commands to execute when the recording is successfully stopped. Note that this does not mean that the file is delivered to the configured destination yet.

  • on_failure (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – Commands to execute if the recording fails to start. If omitted, failures are silently ignored and the call flow continues.

Returns:

The startRecording command.

Return type:

StartRecordingCommandDict

static stop(
name: str,
) → StopRecordingCommandDict[source]

Stops a recording previously started by start(). This is a non-blocking command — execution continues to the next command in the sequence immediately after the stop is initiated.

Parameters:

name (str) – Name of the recording to stop, as set by name in start(). Between 1 and 32 characters, matching ^\S+$.

Returns:

The stopRecording command.

Return type:

StopRecordingCommandDict