Actions allow your Sinch application to control individual calls. The following actions are currently available:
Hangs up a call.
Available to use in a response to an Incoming Call Event callback, an Answered Call Event callback, or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
{ "instructions": [ { … } ], "action": { "name": "hangup" } }
Schema
The name property. Must have the value hangup.
| Value | Description |
|---|---|
| hangup | The |
Continues to set up a call.
Available to use in a response to an Answered Call Event callback or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The continue action.
{ "action": { "name": "continue" } }
Schema
The name property. Must have the value continue.
| Value | Description |
|---|---|
| continue | The |
Determines how a PSTN call is connected.
Available to use in a response to an Incoming Call Event callback or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The connectPstn action.
{ "action": { "name": "connectPstn", "number": "+461234567890", "locale": "en-US", "maxDuration": 3000, "dialTimeout": 10, "cli": "+460987654321", "suppressCallbacks": false, "indications": "se", "amd": { … } } }
Schema
The name property. Must have the value connectPstn.
| Value | Description |
|---|---|
| connectPstn | The |
Used to override where PSTN call is connected. If not specified, the extension the client called is used.
Specifies the locale. Uses the language code according to ISO 639, a dash (-), and a country code according to ISO 3166-1 alpha-2. If not specified, the default locale of en-US is used.
The max duration of the call in seconds (max 14400 seconds). If the call is still connected at that time, it will be automatically disconnected.
The max duration the call will wait in ringing unanswered state before terminating with TIMEOUT/NO ANSWER on PSTN leg and NA/BUSYon MXP leg.
Used to override the CLI (or caller ID) of the client. The phone number of the person who initiated the call is shown as the CLI. To set your own CLI, you may use your verified number or your Dashboard virtual number.
A string that determines the DTMF tones to play to the callee when the call is picked up. Valid characters are: 0-9, #, and w. w renders a 500ms pause. For example, the string ww1234#w#, plays a 1 second pause, the DTMF tones for 1, 2, 3, 4, and #, followed by a 500ms pause and finally the # tone. This is useful if the callout destination requires a conference PIN code or an extension. If there is a calling party, it will hear progress while the DTMF is sent.
The locale's tone to play while ringing.
| Enum Value | Description |
|---|---|
| at | Austria |
| au | Australia |
| bg | Bulgaria |
| br | Brazil |
| be | Belgium |
| ch | Switzerland |
| cl | Chile |
| cn | China |
| cz | Czech Republic |
| de | Germany |
The amd object enables Answering Machine Detection (AMD) and sets whether it works synchronously or asychronously.
You don't need to set cli or number if the values supplied by the client suffice.
Determines how an application-to-application call is connected.
Available to use in a response to an Incoming Call Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The connectMxp action.
{ "action": { "name": "connectMxp", "destination": { … }, "callHeaders": [ … ] } }
Schema
The name property. Must have the value connectMxp.
| Value | Description |
|---|---|
| connectMxp | The |
The type of device and number or endpoint to call.
An optional parameter that allows you to specify or override call headers provided to the receiving Sinch SDK client. Read more about call headers here.
Connects an incoming call to a conference.
Available to use in a response to an Incoming Call Event callback or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The connectConf action.
{ "action": { "name": "connectConf", "conferenceId": "myConference", "moh": "ring" } }
Schema
The name property. Must have the value connectConf.
| Value | Description |
|---|---|
| connectConf | The |
The unique identifier of the conference. Shouldn't exceed 64 characters.
Options to control how DTMF signals are used by the participant in the conference. For information on how to use this feature, read more here.
Means "music on hold". If this optional parameter is included, plays music to the first participant in a conference while they're alone and waiting for other participants to join. If moh isn't specified, the user will only hear silence while alone in the conference.
| Enum Value | Description |
|---|---|
| ring | Plays a progress tone. |
| music1 | Plays music choice 1. |
| music2 | Plays music choice 2. |
| music3 | Plays music choice 3. |
Determines how to route a call to a SIP server.
Available to use in a response to an Incoming Call Event callback or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The connectSip action.
{ "action": { "name": "connectSip", "destination": { … }, "maxDuration": 3000, "cli": "private", "transport": "tls", "suppressCallbacks": false, "callHeaders": [ … ] } }
Schema
The name property. Must have the value connectSip.
| Value | Description |
|---|---|
| connectSip | The |
The type of device and number or endpoint to call.
Type sip for SIP infrastructures.
| Value | Description |
|---|---|
| sip | A SIP address for SIP infrastructures. |
For type sip the value is the SIP address for a SIP endpoint.
The max duration of the call in seconds (max 14400 seconds). If the call is still connected at that time, it will be automatically disconnected.
Used to override the CLI (or caller ID) of the client. The phone number of the person who initiated the call is shown as the CLI. To set your own CLI, you may use your verified number or your Dashboard virtual number.
An optional parameter to specify the SIP transport protocol. If unspecified, UDP is used.
| Enum Value | Description |
|---|---|
| UDP | User Datagram Protocol |
| TCP | Transmission Control Protocol |
| TLS | Transport Layer Security |
Private SIP headers to send with the call.
Means "music on hold". If this optional parameter is included, plays music to the connected participant if the SIP call is placed on hold. If moh isn't specified and the SIP call is placed on hold, the user will only hear silence while during the holding period .
| Enum Value | Description |
|---|---|
| ring | Plays a progress tone. |
| music1 | Plays music choice 1. |
| music2 | Plays music choice 2. |
| music3 | Plays music choice 3. |
Make sure you allow our IP addresses in your SIP server for receiving this traffic. For more information on allowlisting see our SIP-trunking documentation.
This feature is in closed beta - Please, contact Sinch sales for more details.
Determines how to route a call to a Stream/websocket server.
Available to use in a response to an Incoming Call Event callback.
Example code
{
"action": {
"name": "connectStream",
"destination": {
"type": "Websocket",
"endpoint": "wss://yourcompany.com/websocket-server"
},
"streamingOptions": {
"version": 2,
"sampleRate": 44100
},
"maxDuration": 3000,
"callHeaders": [
{
"key": "foo",
"value": "bar"
},
{
"key": "baz",
"value": "qux"
}
]
}
}Schema
The name property. Must have the value connectStream.
| Value | Description |
|---|---|
| connectStream | The |
Specifies where to route the Stream call.
This attribute defines the streaming protocol - currently only Websocket is supported.
| Value | Description |
|---|---|
| Websocket | Use websocket stream protocol |
The Stream/Websocket server address.
Optional parameters for the WebSocket stream.
The max duration of the call in seconds (max 14400 seconds). If the call is still connected at that time, it will be automatically disconnected.
These custom parameters (headers/messages) are sent to your WebSocket server in the initial message when the ConnectStream is established.
After the server response is received Sinch will start to send binary messages and expects to receive binary messages back, encoded with the same CODEC received.
Plays an interactive voice response (IVR) menu to the callee. This menu can play pre-recorded files or text-to-speech messages, collect DTMF tones, and trigger the Prompt Input Event (PIE) callback towards your backend, notifying you of the actions the callee took.
Available to use in a response to an Incoming Call Event callback or an Answered Call Event callback. Can also be used in combination with the Conferences endpoint of the Calling API.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The runMenu action.
{ "action": { "name": "runMenu", "barge": true, "mainMenu": "main", "menus": [ … ] } }
Schema
The name property. Must have the value runMenu.
| Value | Description |
|---|---|
| runMenu | The |
'Barging' means that the user can press a DTMF digit before the prompt has finished playing. If a valid input is pressed, the message will stop playing and accept the input. If barge is disabled, the user must listen to the entire prompt before input is accepted. By default, barging is enabled.
The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed here. If using the enableVoice to enable voice detection, the locale property is required in order to select the input language.
Selects the menu item from the menus array to play first.
Enables voice detection. If enabled, users can say their answers to prompts in addition to entering them using the keypad.
The list of menus available. The menu with the id value of main will always play first. If no menu has an id value of main, an error is returned.
"Parks" the call and places the caller on hold. The caller is placed into a loop, listening to an IVR prompt (either a pre-recorded audio file or generated by text to speech). If the call is unparked, prompts will stop playing immediately. If the max duration is reached, the last prompt will be fully played until the call ends.
Available to use in a response to an Incoming Call Event callback or a Prompt Input Event callback.
Example code
- redirected by Sinch to an appropriate region
https://calling.api.sinch.com/calling/v1/calls/id/{callId}
- United States
https://calling-use1.api.sinch.com/calling/v1/calls/id/{callId}
- Europe
https://calling-euc1.api.sinch.com/calling/v1/calls/id/{callId}
- South America
https://calling-sae1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 1
https://calling-apse1.api.sinch.com/calling/v1/calls/id/{callId}
- Southeast Asia 2
https://calling-apse2.api.sinch.com/calling/v1/calls/id/{callId}
The park action.
{ "action": { "name": "park", "introPrompt": "#tts[Welcome]", "holdPrompt": "#tts[Thank you for your patience, your call is very important to us.]", "maxDuration": 180 } }
Schema
The name property. Must have the value park.
| Value | Description |
|---|---|
| park | The |
The voice and language you want to use for the text-to-speech message. This can either be defined by the ISO 639 locale and language code or by specifying a particular voice. Supported languages and voices are detailed here.
That prompt that is played when the call is first answered. You can use text-to-speech using the #tts[] element, SSML commands using the #ssml[] element.
The prompt that is played on repeat until the call is unparked or the until the maxDuration value is reached. You can use text-to-speech using the #tts[] element, SSML commands using the #ssml[] element.
The maximum amount of time in seconds that the holdPrompt will be played.
The maxDuration value can be set to a maximum of 600 seconds (10 minutes).