sinch.domains.voice.helpers.v2.svaml.calls module
- class sinch.domains.voice.helpers.v2.svaml.calls.Calls[source]
Bases:
objectHelpers to build the call control SVAML commands.
- static answer() AnswerCommandDict[source]
Answers an inbound call leg. This is a non-blocking command — execution continues to the next command in the sequence immediately after the answer is initiated.
- Returns:
The
answercommand.- Return type:
- static bridge_call(
- name: str,
Adds the current call to a bridge, enabling bidirectional audio communication with other calls in the same session. This is a non-blocking command — execution continues to the next command in the sequence immediately after the call joins the bridge.
Bridges are created automatically when referenced by name. If a bridge with the specified name already exists, the call joins that bridge; otherwise, a new bridge is created.
- Parameters:
name (str) – Name of the bridge to join. If no bridge with this name exists in the session, a new one is created automatically.
- Returns:
The
bridgeCallcommand.- Return type:
- static dial(
- to: str | PhoneDict | BaseSipDict | BaseStreamDict | SipDict | StreamDict | VoiceRelayDict,
- *,
- from_: str | PhoneDict | BaseSipDict | BaseStreamDict | SipFromDict | Unset = <sinch.core.sentinel.Unset object>,
- name: str | Unset = <sinch.core.sentinel.Unset object>,
- timeout_duration_seconds: int | Unset = <sinch.core.sentinel.Unset object>,
- max_duration_seconds: int | Unset = <sinch.core.sentinel.Unset object>,
- on_answer: 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_busy: 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_reject: 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_timeout: 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_hangup: 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>,
Initiates a new outbound call leg within the current session.
This is a non-blocking command — the next command in the sequence executes immediately while the call is being established in parallel. Call lifecycle events (answer, busy, reject, timeout, hangup, failure) are handled via the events property.
The from and to endpoint types should ideally match. If they differ, the platform attempts to convert the from value to be compatible with the to type. For example, PSTN supports only E.164 phone numbers, so a SIP address such as sip:46701234567@acme.se can be converted to an E.164 number. If the from value cannot be converted, it defaults to null (anonymous).
- Parameters:
to (Union[str, BaseCallDestinationDict, CallDestinationDict]) – Call destination: a phone number in E.164 format, a SIP URI, a WebSocket endpoint for real-time audio streaming or the Voice Relay service for real-time speech-to-text and text-to-speech. A string is parsed with
Destination.of().from (UnsetOr[Union[str, BaseCallDestinationDict, CallOriginDict]]) – Call origin: a phone number in E.164 format or a SIP URI. A string is parsed with
Destination.of().name (UnsetOr[str]) – Identifier for this call leg within the session. Must be unique across all active call legs in the session. Other commands (e.g., hangup) can reference this name to target this specific leg.
timeout_duration_seconds (UnsetOr[int]) – Maximum time in seconds to wait for the call to be answered. If the timeout expires without an answer, the onTimeout event is triggered.
max_duration_seconds (UnsetOr[int]) – Maximum duration of the call in seconds. The call is terminated automatically when this limit is reached.
on_answer (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call is answered.
on_busy (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call is busy.
on_reject (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call is rejected.
on_timeout (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call is timed out.
on_hangup (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call is hung up.
on_failure (UnsetOr[Union[SvamlCommandDict, Sequence[SvamlCommandDict]]]) – SVAML commands to be executed when the call fails.
from_ (str | PhoneDict | BaseSipDict | BaseStreamDict | SipFromDict | Unset)
- Returns:
The
dialcommand.- Return type:
- static hangup(
- name: str | Unset = <sinch.core.sentinel.Unset object>,
Ends a call leg. This is a non-blocking command — execution continues to the next command in the sequence even though the call has been ended. The onHangup event is triggered for the call leg that was ended.
Any subsequent commands that target the ended call leg (such as messages or other media commands) are valid but will not be executed. Commands that operate independently — such as initiating a new call with dial — will execute normally. This makes it possible, for example, to end one call and immediately start another within the same sequence.
- Parameters:
name (UnsetOr[str]) – Name of the call leg to end, as set by callName in the dial command. If omitted, the current call leg is ended.
- Returns:
The
hangupcommand.- Return type:
- static pause(
- duration_milliseconds: int,
Delays execution of the next command in the sequence for a specified duration. This is a blocking command — no further commands execute until the pause completes.
The pause does not affect call audio; the call remains connected and audio continues uninterrupted.
- Parameters:
duration_milliseconds (int) – Duration of the pause in milliseconds.
- Returns:
The
pausecommand.- Return type: