SIGN UP
Navigation

Managing Scenarios

Methods

Adds a new scenario. Please use the POST method.

Parameters

  • Follow link for authentication parameter names and details.

  • scenario_name:

    string

    The scenario name. The length must be less than 30

  • scenario_script:

    string

    The scenario text. The length must be less than 128 KB.

  • rewrite:

    booleanDefaults to false

    Is the existing scenario rewrite?

Returns

  • result:

    number

    1

  • scenario_id:

    number

    The new scenario ID.

Examples

request:

Add a new scenario: var s='hello';

https://api.voximplant.com/platform_api/AddScenario/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&scenario_name=scen1&scenario_script=var%20s%3D%22hello%22%3B

response:

{
    "result": 1,
    "scenario_id": 1
}

Bind the scenario list with the rule. You should specify the application_id or application_name if you specify the rule_name.

Parameters

  • Follow link for authentication parameter names and details.

  • scenario_id:

    string

    The scenario ID list separated by the ';' symbol.

  • scenario_name:

    string

    Can be used instead of scenario_id. The scenario name list separated by the ';' symbol.

  • rule_id:

    number

    The rule ID.

  • rule_name:

    string

    The rule name that can be used instead of rule_id.

  • application_id:

    number

    The application ID.

  • application_name:

    string

    The application name that can be used instead of application_id.

  • bind:

    booleanDefaults to true

    Bind or unbind?

Returns

  • result:

    number

    1

Examples

request:

Bind the scenarios 1, 2 and 3 with the rule 1.

https://api.voximplant.com/platform_api/BindScenario/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&scenario_id=1;2;3&rule_id=1

response:

Success

{
    "result": 1
}

Deletes the scenario.

Parameters

  • Follow link for authentication parameter names and details.

  • scenario_id:

    string

    The scenario ID list separated by the ';' symbol or the 'all' value.

Returns

  • result:

    number

    1

Examples

request:

Delete the scenario 1 and 3.

https://api.voximplant.com/platform_api/DelScenario/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&scenario_id=1;3

Delete the all scenarios.

https://api.voximplant.com/platform_api/DelScenario/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&scenario_id=all

response:

Success

{
    "result": 1
}

Gets the account's scenarios.

Parameters

  • Follow link for authentication parameter names and details.

  • scenario_id:

    number

    The scenario ID to filter

  • with_script:

    booleanDefaults to false

    Set true to get the scenario text. You must specify the 'scenario_id' too!

  • count:

    numberDefaults to 20

    The max returning record count.

  • offset:

    numberDefaults to 0

    The first N records will be skipped in the output.

Returns

  • result:

    [ ScenarioInfoType ]
  • total_count:

    number

    The total found scenario count.

  • count:

    number

    The returned scenario count.

Examples

request:

Get two scenarios, but skip the first one.

https://api.voximplant.com/platform_api/GetScenarios/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&offset=1&count=2

response:

{
    "count": 2,
    "result": [
        {
            "modified": "2013-09-09 16:35:55",
            "scenario_id": 2,
            "scenario_name": "scen2"
        },
        {
            "modified": "2013-09-09 16:36:50",
            "scenario_id": 3,
            "scenario_name": "scen3"
        }
    ],
    "total_count": 4
}

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

Parameters

  • Follow link for authentication parameter names and details.

  • rule_id:

    number

    The rule ID.

  • rule_name:

    string

    The rule name that can be used instead of rule_id.

  • scenario_id:

    string

    The scenario ID list separated by the ';' symbol.

Returns

  • result:

    number

    1

Examples

request:

Set the scenario loading order: 17, 15, 20.

https://api.voximplant.com/platform_api/ReorderScenarios/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&rule_id=2&scenario_id=17;15;20

response:

{
    "result": 1
}

Edits the scenario. Please use the POST method.

Parameters

  • Follow link for authentication parameter names and details.

  • scenario_id:

    number

    The scenario ID.

  • required_scenario_name:

    string

    The name of the scenario to edit, can be used instead of scenario_id.

  • scenario_name:

    string

    The new scenario name. The length must be less than 30

  • scenario_script:

    string

    The new scenario text. The length must be less than 128 KB.

Returns

  • result:

    number

    1

Examples

request:

Add a new scenario: var s='hello';

https://api.voximplant.com/platform_api/SetScenarioInfo/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&scenario_id=1&scenario_name=scen11&scenario_script=var%20s%3D%22hello%20world%22%3B

response:

Success

{
    "result": 1
}

Start a new conference or join the conference.

Parameters

  • Follow link for authentication parameter names and details.

  • conference_name:

    string

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

  • rule_id:

    number

    The rule ID.

  • user_id:

    number

    The user ID. Run the scripts from the user if set.

  • user_name:

    string

    The user name that can be used instead of user_id. Run the scripts from the user if set.

  • script_custom_data:

    string

    The script custom data (like a script argument). Can be accessed in JS scenario via the VoxEngine.customData() method

  • reference_ip:

    string

    Specifies the IP from the geolocation of predicted subscribers. It allows selecting the nearest server for serving subscribers.

Returns

  • result:

    number

    1

  • 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 will result in AppEvents.HttpRequest VoxEngine event being emitted for scenario, with HTTP request data passed to it.

  • 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 will result in AppEvents.HttpRequest VoxEngine event being emitted for scenario, with HTTP request data passed to it.

Examples

request:

Start the conference from the account.

https://api.voximplant.com/platform_api/StartConference/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&conference_name=boss&rule_id=1&script_custom_data=mystr

Start the conference from the user 1.

https://api.voximplant.com/platform_api/StartConference/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&conference_name=boss&rule_id=1&script_custom_data=mystr&user_id=1

response:

Success

{
    "result": 1,
    "media_session_access_url": "http:\/\/1.2.3.4:12092\/request?id=93e41c6e20811b9b.1380201554.0@1.2.3.4&token=36bc7ce95edc679e32d83bb6f3ad985f"
}

Run the JavaScript scenarios on a VoxImplant server. The scenarios run in a new media session.

Parameters

  • Follow link for authentication parameter names and details.

  • user_id:

    number

    The user ID. Run the scripts from the user if set.

  • user_name:

    string

    The user name that can be used instead of user_id. Run the scripts from the user if set.

  • rule_id:

    number

    The rule ID.

  • script_custom_data:

    string

    The script custom data (like a script argument). Can be accessed in JS scenario via the VoxEngine.customData() method

  • reference_ip:

    string

    Specifies the IP from the geolocation of predicted subscribers. It allows selecting the nearest server for serving subscribers.

  • with_check_url:

    boolean

    Set true to get media server session lists url.

Returns

  • result:

    number

    1

  • 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 will result in AppEvents.HttpRequest VoxEngine event being emitted for scenario, with HTTP request data passed to it.

  • 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 will result in AppEvents.HttpRequest VoxEngine event being emitted for scenario, with HTTP request data passed to it.

Examples

request:

Start the scripts from the account.

https://api.voximplant.com/platform_api/StartScenarios/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&rule_id=1&script_custom_data=mystr

Start the scripts from the user 1.

https://api.voximplant.com/platform_api/StartScenarios/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&rule_id=1&script_custom_data=mystr&user_id=1

response:

Success

{
    "result": 1,
    "media_session_access_url": "http:\/\/1.2.3.4:12092\/request?id=93e41c6e20811b9b.1380201554.0@1.2.3.4&token=36bc7ce95edc679e32d83bb6f3ad985f"
}