sinch.domains.voice.helpers.v2.destinations package
- class sinch.domains.voice.helpers.v2.destinations.Destination[source]
Bases:
objectHelpers to build the
toandfrom_endpoints of a call.- static of(
- value: str,
Builds a call endpoint from a string, detecting its type from the prefix:
phone:+15551234567→ phone number on the PSTN, prefix removed.sip:user@domain/sips:user@domain→ SIP endpoint, URI kept as is.stream:wss://host/path→ WebSocket stream endpoint, prefix removed.Anything else → phone number, value kept as is.
The result only contains the fields found in the string and is accepted as both
toandfrom_ofCalls.dial(). A stream endpoint is only valid asto. Use the dedicated helpers to set the optional fields.- Parameters:
value (str) – Endpoint, optionally prefixed with its type.
- Returns:
The phone, SIP or stream endpoint.
- Return type:
BaseCallDestinationDict
- static phone(
- number: str,
Builds a phone endpoint, which routes the call to a phone number on the Public Switched Telephone Network (PSTN). Valid as both
toandfrom_.- Parameters:
number (str) – Phone number in E.164 format, between 3 and 16 characters, matching
^\+[1-9]\d{1,14}$.- Returns:
The phone endpoint.
- Return type:
- static sip(
- endpoint: str,
- *,
- transport: Literal['UDP',
- 'TCP',
- 'TLS'] | str | ~sinch.core.sentinel.Unset=<sinch.core.sentinel.Unset object>,
- call_headers: List[CallHeaderDict] | Unset = <sinch.core.sentinel.Unset object>,
Builds a SIP destination, which routes the call to a SIP (Session Initiation Protocol) endpoint. Only valid as
to; usesip_from()forfrom_.- Parameters:
endpoint (str) – SIP URI of the destination endpoint, at most 256 characters, matching
^sips?:. Bothsip:(unencrypted) andsips:(TLS-encrypted) schemes are supported.transport (UnsetOr[Union[Literal["UDP", "TCP", "TLS"], str]]) –
Transport protocol to use for the SIP signalling channel. If omitted, the platform selects a default based on the URI scheme:
UDPforsip:andTLSforsips:. Setting this explicitly overrides that default — for example, to forceTCPfor asip:URI or to useTLSwithout switching to thesips:scheme.UDP: Connectionless transport. Lowest overhead; suitable for most standard SIP deployments.TCP: Connection-oriented transport. More reliable for large SIP messages or NAT traversal scenarios.TLS: Encrypted transport. Provides confidentiality and integrity for SIP signalling.
call_headers (UnsetOr[List[CallHeaderDict]]) – Custom SIP headers sent in the call setup, at most 16.
- Returns:
The SIP destination.
- Return type:
- static sip_from(
- endpoint: str,
- *,
- display_name: str | Unset = <sinch.core.sentinel.Unset object>,
Builds a SIP origin, which indicates the call originates from a SIP (Session Initiation Protocol) endpoint. Only valid as
from_; usesip()forto.- Parameters:
endpoint (str) – SIP URI of the originating endpoint, at most 192 characters, matching
^sips?:. Bothsip:(unencrypted) andsips:(TLS-encrypted) schemes are supported.display_name (UnsetOr[str]) – Name presented to the called party as the caller identity, at most 64 characters. Sent as the display name part of the SIP
Fromheader.
- Returns:
The SIP origin.
- Return type:
- static stream(
- endpoint: str,
- *,
- stream_options: StreamOptionsDict | Unset = <sinch.core.sentinel.Unset object>,
- call_headers: List[CallHeaderDict] | Unset = <sinch.core.sentinel.Unset object>,
Builds a stream destination, which routes the call to a WebSocket endpoint for real-time audio processing. Only valid as
to.- Parameters:
endpoint (str) – WebSocket URL that accepts the incoming connection, using
ws://orwss://(recommended). It must be reachable from the public internet and handle the negotiated stream protocol.stream_options (UnsetOr[StreamOptionsDict]) – Stream protocol options:
version(defaults to1),codec(onlyPCM, uncompressed raw audio) andsample_ratein Hz (defaults to8000, the PSTN rate; higher rates only help on non-PSTN paths and increase bandwidth).call_headers (UnsetOr[List[CallHeaderDict]]) – Custom headers sent in the call setup, at most 16.
- Returns:
The stream destination.
- Return type:
- static voice_relay(endpoint: str, tts_voice: ~sinch.domains.voice.models.v2.types.voice_name_enum.VoiceNameEnum | ~typing.Literal['Aarav', 'Aarav_2', 'Aarohi', 'Aarti', 'Aarti_2', 'Aarti_3', 'Aashi', 'Abbi', 'Abdullah', 'Abeo', 'Abril', 'Achara', 'Ada', 'Ada_2', 'Adam', 'Adam_2', 'Aditi', 'Adri', 'Adriano', 'Agnieszka', 'Ahmet', 'Aigul', 'Ainhoa', 'Alain', 'Alba', 'Aled', 'Aleksandar', 'Alessio', 'Alessio_2', 'Alex', 'Alfie', 'Ali', 'Alina', 'Alloy', 'Alloy_2', 'Alonso', 'Alvaro', 'Amal', 'Amala', 'Amanda', 'Amany', 'Amber', 'Ambre', 'Ameha', 'Amina', 'Amy', 'Amy_2', 'Amy_3', 'Ana', 'Anahit', 'Ananya', 'Ananya_2', 'Anbu', 'Ander', 'Andre', 'Andre_2', 'Andrea', 'Andres', 'Andrew', 'Andrew_2', 'Andrew_3', 'Andrew_4', 'Angelo', 'Anila', 'Annette', 'Antoine', 'Antonin', 'Antonio', 'Anu', 'Aoi', 'Arabella', 'Ardi', 'Aria', 'Aria_2', 'Ariane', 'Arjun', 'Arjun_2', 'Arjun_3', 'Arlet', 'Arnau', 'Arnaud', 'Arthur', 'Arya', 'Arya_2', 'Asad', 'Ashley', 'Asilia', 'Astrid', 'Athina', 'Ava', 'Ava_2', 'Ava_3', 'Avri', 'Ayanda', 'Ayanda_2', 'Aysha', 'Babek', 'Banu', 'Bashkar', 'Bassel', 'Bataa', 'Beatrice', 'Beatriz', 'Belkys', 'Bella', 'Benigno', 'Bernd', 'Bianca', 'Bianca_2', 'Bianca_3', 'Blessica', 'BongJin', 'Borislav', 'Brandon', 'Brandon_2', 'Bree', 'Brenda', 'Brian', 'Brian_2', 'Brian_3', 'Brigitte', 'Bryan', 'Bryan_2', 'Bryan_3', 'Burcu', 'Calimero', 'Camila', 'Camilla', 'Camilla_2', 'Camilla_3', 'Candela', 'Carla', 'Carlos', 'Carlota', 'Carly', 'Carmen', 'Cataldo', 'Catalina', 'Cecilio', 'Celeste', 'Celine', 'Celine_2', 'Chantal', 'Chanthavong', 'Charline', 'Chilemba', 'Christel', 'Christoph', 'Christopher', 'Christopher_2', 'Clara', 'Claude', 'Colette', 'Colm', 'Conchita', 'Connor', 'Conrad', 'Cora', 'Cora_2', 'Coralie', 'Cristiano', 'Daichi', 'Dalia', 'Dalia_2', 'Daniel', 'Daniel_2', 'Danielle', 'Danielle_2', 'Dario', 'Dariya', 'Darren', 'Daudi', 'Daulet', 'Davis', 'Davis_2', 'Davis_3', 'Dena', 'Denise', 'Derek', 'Dhwani', 'Diego', 'Dilara', 'Dimas', 'Dmitry', 'Donato', 'Dora', 'Duarte', 'Duncan', 'Dustin', 'Echo', 'Eka', 'Elena', 'Elias', 'Elimu', 'Elin', 'Elizabeth', 'Elke', 'Elliot', 'Eloise', 'Elsa', 'Elsie', 'Elvira', 'Elza', 'Emel', 'Emil', 'Emilio', 'Emily', 'Emma', 'Emma_2', 'Emma_3', 'Emma_4', 'Enric', 'Enrique', 'Eric', 'Estrella', 'Ethan', 'Evelyn', 'Everita', 'Ewa', 'Ewa_2', 'Ezinne', 'Fabio', 'Fabiola', 'Fable', 'Fabrice', 'Fahed', 'Farid', 'Fatima', 'Federico', 'Fenna', 'Fernanda', 'Fiamma', 'Filiz', 'Finn', 'Florian', 'Florian_2', 'Florin', 'Francisca', 'Freya', 'Gabrielle', 'Gabrielle_2', 'Gabrijela', 'Gadis', 'Gagan', 'Gemma', 'Gemma_2', 'Geraint', 'Gerard', 'Gerardo', 'Gianni', 'Giorgi', 'Giorgio', 'Giovanna', 'Gisela', 'Giuseppe', 'Giuseppe_2', 'Gonzalo', 'GookMin', 'Goran', 'Grace', 'Gregory', 'Gudrun', 'Gul', 'GulNawaz', 'Gunnar', 'Guy', 'Gwyneth', 'Hala', 'Hamdan', 'Hamed', 'Hannah', 'Hannah_2', 'Hans', 'Harri', 'Hayk', 'Hedi', 'Hemkala', 'Henri', 'Hila', 'Hillevi', 'HiuGaai', 'Hiujin', 'HiuMaan', 'HoaiMy', 'Hollie', 'HsiaoChen', 'HsiaoYu', 'Humberto', 'Hyunsu', 'Hyunsu_2', 'Hyunsu_3', 'Ida', 'Ilir', 'Iman', 'Imani', 'Imelda', 'Ines', 'Ines_2', 'Ingrid', 'InJoon', 'Irene', 'Irma', 'Isabella', 'Isabella_2', 'Isabella_3', 'Isabelle', 'Isabelle_2', 'Iselin', 'Isidora', 'Ismael', 'Ivy', 'Ivy_2', 'Jacek', 'Jacob', 'Jacqueline', 'Jajang', 'Jamal', 'James', 'Jan', 'Jane', 'Jane_2', 'Jann', 'Jasmine', 'Jasmine_2', 'Jason', 'Javier', 'Jean', 'Jenny', 'Jenny_2', 'Jenny_3', 'Jeppe', 'Jerome', 'Jihye', 'JiMin', 'Jimmie', 'Jitka', 'Joana', 'Joanna', 'Joanna_2', 'Joanna_3', 'Joanne', 'Joey', 'Joey_2', 'Jonas', 'Jorge', 'Jorge_2', 'Joseph', 'Josephine', 'Juan', 'Julio', 'Justin', 'Justin_2', 'Kai', 'Kajal', 'Kajal_2', 'Kalina', 'Kani', 'Karina', 'Karl', 'Karla', 'Kasper', 'Katja', 'Kavya', 'Kavya_2', 'Kazuha', 'Keita', 'Ken', 'Kendra', 'Kendra_2', 'Keomany', 'Kert', 'Kevin', 'Killian', 'Kim', 'Kimberly', 'Kimberly_2', 'Klarissa', 'Klaus', 'Kumar', 'Kunal', 'Kunal_2', 'Laia', 'Laila', 'Laith', 'Larissa', 'Latifa', 'Laura', 'Laura_2', 'Layla', 'Lea', 'Lea_2', 'Lea_3', 'Leah', 'Leila', 'Leni', 'Lennart', 'Leonas', 'Leticia', 'Lewis', 'Lia', 'Liam', 'Lian', 'Lian_2', 'Libby', 'Liberto', 'Lisa', 'Lisa_2', 'Lisandro', 'Liv', 'Livia', 'Livia_2', 'Lola', 'Lorena', 'Lorenzio', 'Lorenzo', 'Lotte', 'Louisa', 'Lucia', 'Lucia_2', 'Lucia_3', 'Luciano', 'Lucien', 'Luis', 'Lukas', 'Luke', 'Luna', 'Luna_2', 'Lupe', 'Lupe_2', 'Lupe_3', 'Maarten', 'Macerio', 'Macerio_2', 'Madhur', 'Madina', 'Mads', 'Maisie', 'Maja', 'Manohar', 'Manuel', 'Manuela', 'Marcello', 'Marcelo', 'Marek', 'Margarita', 'Maria', 'Marija', 'Marina', 'Mario', 'Marlene', 'Marta', 'Maryam', 'Masaru', 'Mateo', 'Mathieu', 'Matthew', 'Matthew_2', 'Matthew_3', 'Mattias', 'Maurice', 'Maxim', 'Maya', 'Mayu', 'Mekdes', 'Mia', 'Mia_2', 'Mia_3', 'Michelle', 'Midhun', 'Miguel', 'Mitchell', 'Mizuki', 'Moaz', 'Mohan', 'Molly', 'Monica', 'Mouna', 'Muuse', 'Nabanita', 'Naja', 'NamMinh', 'Nanami', 'Nanami_2', 'Nancy', 'Nancy_2', 'Naoki', 'Natasha', 'Neerja', 'Neerja_2', 'Neil', 'Nestoras', 'Nia', 'Niamh', 'Niamh_2', 'Nicholas', 'Nicholas_2', 'Nicolau', 'Nicole', 'Nil', 'Nilar', 'Nils', 'Niranjan', 'Niwat', 'Noah', 'Noemi', 'Noora', 'Noura', 'Nova', 'Nova_2', 'Nuria', 'Ojas', 'Ola', 'Ola_2', 'Oliver', 'Olivia', 'Ollie', 'Ollie_2', 'Omar', 'Ona', 'Onyx', 'Orla', 'Osman', 'Ostap', 'Pallavi', 'Palmira', 'Paloma', 'Paola', 'Pedro', 'Pedro_2', 'Pelayo', 'Penelope', 'Pernille', 'Petra', 'Phoebe', 'Phoebe_2', 'Pierina', 'Piseth', 'Polina', 'Prabhat', 'Prabhat_2', 'Pradeep', 'Premwadee', 'Priyom', 'Rafiki', 'Ralf', 'Rami', 'Ramona', 'Rana', 'Raquel', 'Raveena', 'Reem', 'Rehaan', 'Rehaan_2', 'Rehema', 'Remi', 'Remi_2', 'Remy', 'Remy_2', 'Renata', 'Ricardo', 'Rinaldo', 'Roberto', 'Rodrigo', 'Roger', 'Roi', 'Rok', 'Rosa', 'Ruben', 'Russell', 'Ruth', 'Ruth_2', 'Ryan', 'Ryan_2', 'Sabela', 'Sabrina', 'Sabrina_2', 'Sagar', 'Saleh', 'Salli', 'Salli_2', 'Salli_3', 'Salma', 'Salman', 'Salome', 'Sam', 'Sameera', 'Samuel', 'Sana', 'Sapna', 'Sara', 'Saranya', 'Sardor', 'Saul', 'Sebastian', 'Selma', 'SeoHyeon', 'Seoyeon', 'Seoyeon_2', 'Seoyeon_3', 'Seraphina', 'Seraphina_2', 'Serena', 'Serena_2', 'Sergio', 'Sergio_2', 'Shakir', 'Shimmer', 'Shiori', 'Shruti', 'Siqiniq', 'Siqiniq_2', 'Siti', 'Sobhana', 'Soffie', 'Sofia', 'Sofie', 'Sonia', 'SoonBok', 'Sophie', 'Sophie_2', 'Srecko', 'Sreymom', 'Steffan', 'Steffan_2', 'Steffan_3', 'Stephen', 'Stephen_2', 'Subhasini', 'Sukant', 'SunHi', 'SunHi_2', 'Surya', 'Suvi', 'Svetlana', 'Swara', 'Sylvie', 'Sylvie_2', 'Taim', 'Takumi', 'Takumi_2', 'Tamas', 'Tania', 'Tanishaa', 'Tanja', 'Taqqiq', 'Taqqiq_2', 'Tatyana', 'Teo', 'Teresa', 'Thalita', 'Thalita_2', 'Thalita_3', 'Thando', 'Themba', 'Thiago', 'Thierry', 'Thierry_2', 'Thiha', 'Thilini', 'Thomas', 'Tiana', 'Tiffany', 'Tim', 'Tina', 'Tomas', 'Tomoko', 'Tony', 'Triana', 'Tristan', 'Tristan_ES', 'Tristan_ES_2', 'Tuti', 'Tyler', 'Ubax', 'Uzma', 'Vaani', 'Valentina', 'Valerio', 'Valluvar', 'Venba', 'Vera', 'Vesna', 'Vicki', 'Vicki_2', 'Vicki_3', 'Victor', 'Viktoria', 'Vitoria', 'Vitoria_2', 'Vivienne', 'Vivienne_2', 'Vlasta', 'WanLung', 'Wayne', 'Willem', 'William', 'William_2', 'Xiaochen', 'Xiaochen_2', 'Xiaochen_3', 'Xiaochen_4', 'Xiaohan', 'Xiaohan_2', 'Xiaomeng', 'XiaoMin', 'Xiaomo', 'Xiaoqiu', 'Xiaorou', 'Xiaorui', 'Xiaoshuang', 'Xiaoshuang_2', 'Xiaoshuang_3', 'Xiaotong', 'Xiaoxiao', 'Xiaoxiao_2', 'Xiaoxiao_3', 'Xiaoxiao_4', 'Xiaoxiao_5', 'Xiaoyan', 'Xiaoyi', 'Xiaoyi_2', 'Xiaoyou', 'Xiaoyou_2', 'Xiaoyou_3', 'Xiaoyu', 'Xiaoyu_2', 'Xiaozhen', 'Ximena', 'Ximena_ES', 'Ximena_ES_2', 'Ximena_ES_3', 'Yago', 'Yan', 'Yara', 'Yashica', 'Yasmin', 'Yesui', 'Yolanda', 'YuJin', 'Yundeng', 'Yunfan', 'Yunfan_2', 'Yunfeng', 'Yunhan', 'Yunhao', 'YunJhe', 'Yunjian', 'Yunjie', 'YunSong', 'Yunxi', 'Yunxi_2', 'Yunxia', 'Yunxia_2', 'Yunxiang', 'Yunxiao', 'Yunxiao_2', 'Yunyang', 'Yunye', 'Yunye_2', 'Yunyi', 'Yunyi_2', 'Yunze', 'Yunzhe', 'Yves', 'Yvette', 'Zariyah', 'Zayd', 'Zeina', 'Zhiyu', 'Zhiyu_2', 'Zofia', 'Zuri'] | ~typing.Annotated[str, ~pydantic.types.Strict(strict=True)], stt_language: str, *, enable_interruptions: bool | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>, call_headers: ~typing.List[~sinch.domains.voice.models.v2.types.call_header_dict.CallHeaderDict] | ~sinch.core.sentinel.Unset = <sinch.core.sentinel.Unset object>) VoiceRelayDict[source]
Builds a Voice Relay destination, which routes the call through the Voice Relay service, enabling real-time speech-to-text (STT) and text-to-speech (TTS) over a WebSocket connection to the application backend. Only valid as
to.- Parameters:
endpoint (str) – URL of the server that accepts the WebSocket request.
tts_voice (Union[VoiceNameEnum, VoiceName]) – Default voice for speech synthesis, used when a WebSocket TTS message does not override it. Use
VoiceNameEnumto browse voices with their language, gender and pricing, orVoiceNameByLanguageEnumto browse them grouped by language.stt_language (str) – BCP-47 language tag used to transcribe the inbound audio.
enable_interruptions (UnsetOr[bool]) – Allows barge-in during TTS playback. When
True(the platform default), playback stops as soon as inbound speech is detected, unless the content is marked as uninterruptible. WhenFalse, playback continues, but an interruption signal is still sent over the WebSocket.call_headers (UnsetOr[List[CallHeaderDict]]) – Custom headers sent in the call setup, at most 16.
- Returns:
The Voice Relay destination.
- Return type: