Rate this page:

Scenarios

Methods

AddScenario
Copy URL

Adds a new scenario to the Shared folder, so the scenario is available in all the existing applications. Please use the POST method.

When adding a scenario to the Shared folder, the application_id and application_name parameters should not be provided.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
AddScenario example

Parameters

  • application_id:

    number

    Optional

    Application ID to bind the scenario to

  • application_name:

    string

    Optional

    Application name to bind the scenario to

  • rewrite:

    boolean

    Optional
    Defaults on:   false

    Whether to rewrite the existing scenario

  • rule_id:

    number

    Optional

    The rule ID. The new scenario binds to the specified rule. Please note, if you do not bind the scenario to any rule, you cannot execute the scenario. Can be used instead of the rule_name parameter

  • rule_name:

    string

    Optional

    The rule name. Can be used instead of the rule_id parameter

  • scenario_name:

    string

    The scenario name. The length should be less than 30

  • scenario_script:

    string

    Optional

    The scenario text. Use the application/x-www-form-urlencoded content type with UTF-8 encoding. The length should be less than 128 KB

Returns

  • result:

    number

    Returns 1 if the request has been completed successfully

  • scenario_id:

    number

    The new scenario ID

BindScenario
Copy URL

Bind the scenario list to the rule. You should specify the application_id or application_name if you specify the rule_name. Please note, the scenario and the routing rule need to be within the same application.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
BindScenario example

Parameters

  • application_id:

    number

    Optional

    The application ID. Can be used instead of the application_name parameter

  • application_name:

    string

    Optional

    The application name. Can be used instead of the application_id parameter

  • bind:

    boolean

    Optional
    Defaults on:   true

    Whether to bind or unbind (set true or false respectively)

  • rule_id:

    number

    Optional

    The rule ID to bind the scenario. The rule and the scenario need to be in the same application. Required unless rule_name is provided.

  • rule_name:

    string

    Optional

    The rule name. Required unless rule_id is provided.

  • scenario_id:

    intlist

    Optional

    The scenario ID list separated by semicolons (;). Required unless scenario_name is provided.

  • scenario_name:

    stringlist

    Optional

    The scenario name list separated by semicolons (;). Required unless scenario_id is provided.

Returns

  • result:

    number

    Returns 1 if the request has been completed successfully

DelScenario
Copy URL

Deletes the scenario.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
DelScenario example

Parameters

  • scenario_id:

    intlist

    Optional

    The scenario ID list separated by semicolons (;). Use the 'all' value to delete all scenarios in all applications. Required unless scenario_name is provided.

  • scenario_name:

    stringlist

    Optional

    The scenario name list separated by semicolons (;). Required unless scenario_id is provided.

Returns

  • result:

    number

    Returns 1 if the request has been completed successfully

GetScenarios
Copy URL

Gets the account's scenarios.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
GetScenarios example

Parameters

  • application_id:

    number

    Optional

    ID of the scenario's application

  • application_name:

    string

    Optional

    Name of the scenario's application

  • count:

    number

    Optional
    Defaults on:   20

    The maximum returning record count

  • offset:

    number

    Optional
    Defaults on:   0

    The first N records are skipped in the output

  • scenario_id:

    number

    Optional

    The scenario ID to filter

  • scenario_name:

    string

    Optional

    The scenario name to filter. Exact match. Combines with scenario_id when both are passed. Use with application_id or application_name to limit the result to one application

  • with_script:

    boolean

    Optional
    Defaults on:   false

    Whether to get the scenario text. You should specify the 'scenario_id' too!

Returns

  • application_id:

    number

    ID of the scenario's application

  • application_name:

    string

    Name of the scenario's application

  • count:

    number

    The returned scenario count

  • extended_application_name:

    string

    Application name including the node name

  • total_count:

    number

    The total found scenario count

ReorderScenarios
Copy URL

Configures the order of scenarios that are assigned to the specified rule.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
ReorderScenarios example

Parameters

  • rule_id:

    number

    Optional

    The rule ID. Required unless rule_name is provided.

  • rule_name:

    string

    Optional

    The rule name. Required unless rule_id is provided.

  • scenario_id:

    intlist

    The scenario ID list separated by semicolons (;)

Returns

  • result:

    number

    Returns 1 if the request has been completed successfully

SetScenarioInfo
Copy URL

Edits the scenario. You can edit the scenario's name and body. Please use the POST method.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
SetScenarioInfo example

Parameters

  • required_scenario_name:

    string

    Optional

    Name of the scenario to edit. Required unless scenario_id is provided.

  • scenario_id:

    number

    Optional

    Scenario ID. Required unless required_scenario_name is provided.

  • scenario_name:

    string

    Optional

    New scenario name. The length should be less than 30

  • scenario_script:

    string

    Optional

    New scenario text. Use the application/x-www-form-urlencoded content type with UTF-8 encoding. The length should be less than 128 KB

Returns

  • result:

    number

    Returns 1 if the request has been completed successfully

StartConference
Copy URL

Runs a session for video conferencing or joins the existing video conference session.

When you create a session by calling this method, a scenario runs on one of the servers dedicated to video conferencing. All further method calls with the same conference_name do not create a new video conference session but join the existing one.

Use the StartScenarios method for creating audio conferences.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
CallsSMS
StartConference example

Parameters

  • application_id:

    number

    Optional

    The application ID. Can be used instead of the application_name parameter

  • application_name:

    string

    Optional

    The application name. Can be used instead of the application_id parameter

  • conference_name:

    string

    The conference name. The name length should be less than 50 symbols

  • reference_ip:

    string

    Optional

    Specifies the IP from the geolocation of predicted subscribers. It allows selecting the nearest server for serving subscribers. If not specified, the IP address of the HTTP request is used

  • rule_id:

    number

    Optional

    The rule ID that needs to be launched. Please note, the necessary scenario needs to be attached to the rule. Required unless rule_name is provided.

  • rule_name:

    string

    Optional

    The rule name. Required unless rule_id is provided.

  • script_custom_data:

    string

    Optional

    The script custom data, that can be accessed in the scenario via the VoxEngine.customData() method. Use the application/x-www-form-urlencoded content type with UTF-8 encoding.

  • server_location:

    string

    Optional

    Specifies the location of the server where the scenario needs to be executed. Has higher priority than reference_ip. Request getServerLocations for possible values

  • user_id:

    number

    Optional

    The user ID. Run the scripts from the user if set. Can be used instead of the user_name parameter

  • user_name:

    string

    Optional

    The user name. Run the scripts from the user if set. Can be used instead of the user_id parameter

Returns

  • call_session_history_id:

    number

    The call session history ID. To search a call session result, paste the ID to the GetCallHistory method's call_session_history_id parameter

  • media_session_access_secure_url:

    string

    The URL to control a created media session. It can be used for arbitrary tasks such as stopping scenario or passing additional data to it. Making HTTPS request on this URL results in the AppEvents.HttpRequest VoxEngine event being triggered for a scenario, with an HTTP request data passed to it

  • media_session_access_url:

    string

    The URL to control a created media session. It can be used for arbitrary tasks such as stopping scenario or passing additional data to it. Making HTTP request on this URL results in the AppEvents.HttpRequest VoxEngine event being triggered for a scenario, with an HTTP request data passed to it

  • result:

    number

    Returns 1 if the request has been completed successfully

StartScenarios
Copy URL

Runs JavaScript scenarios on a Voximplant server. The scenarios run in a new media session. To start a scenario, pass the routing rule ID associated with the necessary scenario. You can use both GET and POST requests at your choice. If you need to send custom data, we recommend to use the POST method and to include the data in the custom_data field of the request body. The maximum number of concurrent HTTP-requests is limited to 200. If this number is exceeded, this method returns the 429 code error (Too Many Requests) until the number of active requests is reduced. If you exceed this number, you get the 429 error code.

Available for roles

To call this method, make sure your service account has one of the following roles:

See Available Roles
Owner
Admin
Developer
CallsSMS
StartScenarios example

Parameters

  • application_id:

    number

    Optional

    The application ID. Can be used instead of the application_name parameter

  • application_name:

    string

    Optional

    The application name. Can be used instead of the application_id parameter

  • reference_ip:

    string

    Optional

    Specifies the IP from the geolocation of predicted subscribers. It allows selecting the nearest server for serving subscribers. If not specified, the IP address of the HTTP request is used

  • rule_id:

    number

    Optional

    The rule ID that needs to be launched. Please note, the necessary scenario needs to be attached to the rule. Required unless rule_name is provided.

  • rule_name:

    string

    Optional

    The rule name. Required unless rule_id is provided.

  • script_custom_data:

    string

    Optional

    The script custom data, that can be accessed in the scenario via the VoxEngine.customData() method. Use the application/x-www-form-urlencoded content type with UTF-8 encoding

  • server_location:

    string

    Optional

    Specifies the location of the server where the scenario needs to be executed. Has higher priority than reference_ip. Request getServerLocations for possible values

  • user_id:

    number

    Optional

    The user ID. Run the scripts from the user if set. Can be used instead of the user_name parameter

  • user_name:

    string

    Optional

    The user name. Run the scripts from the user if set. Can be used instead of the user_id parameter

Returns

  • call_session_history_id:

    number

    The call session history ID. To search a call session result, paste the ID to the GetCallHistory method's call_session_history_id parameter

  • media_session_access_secure_url:

    string

    The URL to control a created media session. You can use it for arbitrary tasks such as stopping scenario or passing additional data to it. Making HTTPS request on this URL results in the AppEvents.HttpRequest VoxEngine event being triggered for scenario, with HTTP request data passed to it

  • media_session_access_url:

    string

    The URL to control a created media session. You can use it for arbitrary tasks such as stopping scenario or passing additional data to it. Making HTTP request on this URL results in the AppEvents.HttpRequest VoxEngine event being triggered for scenario, with HTTP request data passed to it

  • result:

    number

    Returns 1 if the request has been completed successfully

Rate this page: