sinch.domains.voice.api.v2.calls_apis module

class sinch.domains.voice.api.v2.calls_apis.Calls(sinch)[source]

Bases: BaseVoice

start(commands: ~typing.List[~sinch.domains.voice.models.v2.svaml.types.amd_command_dict.AmdCommandDict | ~sinch.domains.voice.models.v2.svaml.types.dial_command_dict.DialCommandDict | ~sinch.domains.voice.models.v2.svaml.types.messages_command_dict.MessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_messages_command_dict.StopMessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.custom_event_command_dict.CustomEventCommandDict | ~sinch.domains.voice.models.v2.svaml.types.hangup_command_dict.HangupCommandDict | ~sinch.domains.voice.models.v2.svaml.types.answer_command_dict.AnswerCommandDict | ~sinch.domains.voice.models.v2.svaml.types.pause_command_dict.PauseCommandDict | ~sinch.domains.voice.models.v2.svaml.types.start_recording_command_dict.StartRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_recording_command_dict.StopRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.bridge_call_command_dict.BridgeCallCommandDict | ~sinch.domains.voice.models.v2.svaml.types.menu_command_dict.MenuCommandDict | ~sinch.domains.voice.models.v2.svaml.types.goto_menu_command_dict.GotoMenuCommandDict], service_id: str | None = None, idempotency_key: str | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, **kwargs) StartCallResponse[source]

Create a new outbound call, associated to the project’s default service or to the service specified in the serviceId query parameter.

Parameters:
  • commands (List[SvamlCommandDict]) – (required) SVAML commands describing the call flow.

  • service_id (Optional[str]) – (optional) The ID of the service to use for the call. If omitted, the project’s default service is used.

  • idempotency_key (UnsetOr[Optional[str]]) – (optional) Client-generated idempotency key to safely retry requests. If a request with the same key is received within 10 minutes, the cached response from the original request is returned. Using a random UUID (v4) is strongly recommended.

  • **kwargs

    Additional parameters for the request.

Returns:

The created call session.

Return type:

StartCallResponse

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

list(
service_id: str | None = None,
from_: str | None = None,
to: str | None = None,
call_type: Literal['PHONE', 'SIP', 'STREAM', 'VOICE_RELAY'] | Annotated[str, Strict(strict=True)] | None = None,
start_time: datetime | None = None,
end_time: datetime | None = None,
call_result: Literal['QUEUED', 'INITIATED', 'IN_PROGRESS', 'COMPLETED', 'REJECTED', 'NO_ANSWER', 'CANCEL', 'BUSY', 'FAILED'] | Annotated[str, Strict(strict=True)] | None = None,
call_reason: Literal['OK', 'NOT_AVAILABLE', 'CALLER_HANGUP', 'CALLEE_HANGUP', 'MANAGER_HANGUP', 'DID_NOT_FOUND', 'INVALID_SCRIPT', 'UNKNOWN_PRODUCT', 'NO_MORE_ROUTES', 'ERROR'] | Annotated[str, Strict(strict=True)] | None = None,
page_size: int | None = None,
page: int | None = None,
**kwargs,
) Paginator[ListCallsResponse, Call][source]

List and filter calls made with Sinch

Parameters:
  • service_id (Optional[str]) – (optional) The ID of the service.

  • from (Optional[str]) – (optional) Only include calls where from matches this origin. For inbound calls, this is the caller; for outbound calls, this is the calling party.

  • to (Optional[str]) – (optional) Only include calls where to matches this destination. For inbound calls, this is the called party; for outbound calls, this is the callee/recipient.

  • call_type (Optional[CallType]) – (optional) Only include calls of the specified type. If omitted, calls of all types are included.

  • start_time (Optional[datetime]) – (optional) Only include calls that started at or after this timestamp.

  • end_time (Optional[datetime]) – (optional) Only include calls that ended before this timestamp (exclusive).

  • call_result (Optional[CallResult]) – (optional) Filter results to only include calls whose call result matches the specified value. If omitted, calls with any result are included.

  • call_reason (Optional[CallReason]) – (optional) Filter results to only include calls whose call reason matches the specified value. If omitted, calls with any reason are included.

  • page_size (Optional[int]) – (optional) Number of items to be returned on each page.

  • page (Optional[int]) – (optional) Page number (1-based).

  • **kwargs

    Additional parameters for the request.

  • from_ (str | None)

Returns:

LinkBasedPaginator with Call items

Return type:

Paginator[ListCallsResponse,Call]

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

get(call_id: str, **kwargs) Call[source]

Retrieve detailed information about a specific call using its unique identifier.

Parameters:
  • call_id (str) – (required) The ID of the call.

  • **kwargs

    Additional parameters for the request.

Returns:

The call details.

Return type:

Call

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

interact_by_call_id(call_id: str, commands: ~typing.List[~sinch.domains.voice.models.v2.svaml.types.amd_command_dict.AmdCommandDict | ~sinch.domains.voice.models.v2.svaml.types.dial_command_dict.DialCommandDict | ~sinch.domains.voice.models.v2.svaml.types.messages_command_dict.MessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_messages_command_dict.StopMessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.custom_event_command_dict.CustomEventCommandDict | ~sinch.domains.voice.models.v2.svaml.types.hangup_command_dict.HangupCommandDict | ~sinch.domains.voice.models.v2.svaml.types.answer_command_dict.AnswerCommandDict | ~sinch.domains.voice.models.v2.svaml.types.pause_command_dict.PauseCommandDict | ~sinch.domains.voice.models.v2.svaml.types.start_recording_command_dict.StartRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_recording_command_dict.StopRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.bridge_call_command_dict.BridgeCallCommandDict | ~sinch.domains.voice.models.v2.svaml.types.menu_command_dict.MenuCommandDict | ~sinch.domains.voice.models.v2.svaml.types.goto_menu_command_dict.GotoMenuCommandDict], idempotency_key: str | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, **kwargs) None[source]

Interact with an ongoing call by submitting a set of SVAML commands. Use this to force disconnect, play messages, bridge with another call, or perform other call control actions.

Parameters:
  • call_id (str) – (required) The ID of the call.

  • commands (List[SvamlCommandDict]) – (required) SVAML commands describing the call flow.

  • idempotency_key (UnsetOr[Optional[str]]) – (optional) Client-generated idempotency key to safely retry requests. If a request with the same key is received within 10 minutes, the cached response from the original request is returned. Using a random UUID (v4) is strongly recommended.

  • **kwargs

    Additional parameters for the request.

Returns:

None

Return type:

None

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.

interact_by_call_name(session_id: str, call_name: str, commands: ~typing.List[~sinch.domains.voice.models.v2.svaml.types.amd_command_dict.AmdCommandDict | ~sinch.domains.voice.models.v2.svaml.types.dial_command_dict.DialCommandDict | ~sinch.domains.voice.models.v2.svaml.types.messages_command_dict.MessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_messages_command_dict.StopMessagesCommandDict | ~sinch.domains.voice.models.v2.svaml.types.custom_event_command_dict.CustomEventCommandDict | ~sinch.domains.voice.models.v2.svaml.types.hangup_command_dict.HangupCommandDict | ~sinch.domains.voice.models.v2.svaml.types.answer_command_dict.AnswerCommandDict | ~sinch.domains.voice.models.v2.svaml.types.pause_command_dict.PauseCommandDict | ~sinch.domains.voice.models.v2.svaml.types.start_recording_command_dict.StartRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.stop_recording_command_dict.StopRecordingCommandDict | ~sinch.domains.voice.models.v2.svaml.types.bridge_call_command_dict.BridgeCallCommandDict | ~sinch.domains.voice.models.v2.svaml.types.menu_command_dict.MenuCommandDict | ~sinch.domains.voice.models.v2.svaml.types.goto_menu_command_dict.GotoMenuCommandDict], idempotency_key: str | None | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, **kwargs) None[source]

Interact with an ongoing call identified by its session and call name by submitting a set of SVAML commands. Use this to force disconnect, play messages, bridge with another call, or perform other call control actions.

Parameters:
  • session_id (str) – (required) The ID of the session.

  • call_name (str) – (required) The name of the call leg within the session, as assigned by the callName property in the dial command.

  • commands (List[SvamlCommandDict]) – (required) SVAML commands describing the call flow.

  • idempotency_key (UnsetOr[Optional[str]]) – (optional) Client-generated idempotency key to safely retry requests. If a request with the same key is received within 10 minutes, the cached response from the original request is returned. Using a random UUID (v4) is strongly recommended.

  • **kwargs

    Additional parameters for the request.

Returns:

None

Return type:

None

For detailed documentation, visit https://developers.sinch.com/docs/voice-2.0.