Start scenario call
Scenario call
| Method | start.scenario_call |
|---|---|
| API version | v4.0 |
| Description | The method creates a call according to the configured scenario. To use the method, all you need is a virtual number and scenarios. |
| Return to list of methods | |
Request parameters
| Name | Type | Required | Valid values | Description | |
|---|---|---|---|---|---|
| access_token | string | yes | Authentication session key | ||
| virtual_phone_number | string | yes |
Virtual number rented by the client. The number format must comply with the international
E.164 standard (for example, |
||
| virtual_phone_usage_rule | string | no |
Rules for using a virtual number. Allows you to dynamically change the virtual number when calling. If a suitable number satisfying the selected rule is not found, the number specified in the
Note: the default rule is |
||
| external_id | string | no | A unique identifier that can be used to associate a call event with an external system. | ||
| dtmf_string | string | no | 0-9, *, # | Specifies the DTMF that will be sent to the subscriber specified in the contact parameter. Using the . symbol (= "1 second") you can set a timeout after which the DTMF symbol will be sent. Example: .12.1..4 - that is, after 1 second the number 12 will be sent, then after 1 second the number 1, and after 2 seconds the number 4.
|
|
| contact | string | yes |
The number of the subscriber to whom the call is made. The number format must match
the international E.164 standard (for example, Note: if the Note: employee extension numbers are not supported. |
||
| first_call | string | yes | contact, employee |
Defines the number to call first:
|
|
| switch_at_once | boolean | no | true, false |
Default value If the
If
Note: if the |
|
| early_switching | boolean | no | true, false |
Default value If the parameter has the value For example, an operator is waiting for a call to reach a subscriber, but the subscriber is unavailable and their voicemail is activated; then, when Note: the parameter can have the value |
|
| scenario_id | number | yes | A unique scenario identifier that can be obtained using the DATA API - Getting a list of scenarios. | ||
| direction | string | no | in, out | The default value is in. Determines the direction of the call: in - Incoming call, out - Outgoing call.
|
|
Message to be played to the subscriber specified in the parameter contact |
|||||
| contact_message | object | no |
Defines the parameters of the message that needs to be played to the subscriber specified in the Note: after the message has finished playing, the system melody will be played on a loop -
|
||
| type | string | yes | media, tts |
Defines the message type: |
|
| value | string | yes |
If the If the Note: the length of the TTS message is regulated by the tariff plan and the established limit. |
||
| Message to be played back to an employee | |||||
| employee_message | object | no |
Defines the parameters of the message that needs to be played to the employee. The message to the employee specified in the scenario takes precedence over the message from the Note: after the message has finished playing, the message from the
|
||
| type | string | yes | media, tts |
Defines the message type: |
|
| value | string | yes | If the If the Note: the length of the TTS message is regulated by the tariff plan and the established limit. |
||
Response parameters
| Name | Type | Required | Description |
|---|---|---|---|
| call_session_id | number | yes | Unique call session identifier |
Example request
{
"jsonrpc": "2.0",
"method": "start.scenario_call",
"id": "req1",
"params": {
"access_token": "2fRN4g217ca0b4224a67988aff3e584f91964a692045415f36fa66146f5a3c1ae1f6093d",
"virtual_phone_number": "74993720692",
"external_id": "34rty567",
"dtmf_string": "..1.2.3",
"contact": "79260000000",
"first_call": "employee",
"switch_at_once": false,
"scenario_id": 23456,
"direction": "in",
"contact_message": {
"type": "media",
"value": "237"
},
"employee_message": {
"type": "media",
"value": "237"
}
}
}
Example response
{
"jsonrpc": "2.0",
"id": "req1",
"result": {
"data": {
"call_session_id": 234568
}
}
}
List of returned errors
| Error text | Error code | Mnemonics | Description |
|---|---|---|---|
The maximum length of a Text-to-Speech message is {tts_message_max_length}. The length of your message is {sent_tts_message_length} |
-32602 | tts_text_exceeded |
Message length has exceeded the permissible limit set by the tariff plan |
The media file with id {media_file_id} was not found |
-32602 | media_file_not_found |
|
Virtual phone number {virtual_phone_number} not found. It is not your virtual phone number. |
-32007 | virtual_phone_number_not_found |
If you use a virtual number that does not belong to the client |
Scenario with id {scenario_id} was not found |
-32602 | scenario_not_found |
|
The contact parameter cannot contain your own virtual phone number |
-32602 | own_virtual_phone_number_not_allowed |
Calling your own virtual number is prohibited |
The contact {contact} has been found in the blacklist |
-32602 | contact_in_blacklist |
|
| The character encoding must be UTF-8 | -32602 | character_encoding_not_allowed |
See also the section "List of errors common for all methods".