The api_start event can report the following states: dialog, early, ringing, incoming. In accordance with them, as well as using \ With the passed parameters, the external system can determine the current state and select the correct behavior.

Control can only be intercepted by one of the connected systems - the one that first sends the message "ivrapi_accept" within its websocket connection (token-api: ivrapi). +\ Further management is carried out via websocket token-api ivrapi.

Component External control via API

:icons:font :hardbreaks: :imagesdir: ../../../assets/images :toc-title: Contents :toc:

Description

Transfers the script during its activity under external control via API (HTTP/WebSocket). +\

If the dialog has not yet been established (in the `api_start` event, the `state` field has a value different from `dialog`), then from the control the system requires compliance with SIP workflow. That is, it is necessary to send appropriate responses before using the functionality reproduction, recording, translation. +\

Before sending the response 2xx you should: a) Translation (203, refer) be replaced by sending the response 3xx (202, `answer`). b) Ending the conversation (201, bye) should be replaced by sending a response 4xx-6xx (202, `answer`). c) Do not use translation components. d) Do not use components for working with media traffic (playback, recording, etc.), except in the case of when the current state of the conversation is `early`, that is, the last response sent was `183 Session Progress`.

Events of types `ivrevents.api_start` and `ivrevents.api_stop` are generated about the start and completion of the component’s operation. They are also sent via subscription to websocket connections (message `notify` within the token-api `subscribe`). +\

Table 1. System characteristics

Index

224

Short name

api

Script types

IVR

Start module

era_sip_ivr_script_component_api

Mode

Asynchronous

Icon

224

Branching type

Branching, closing

Properties

Table 2. Properties
Specification Description

Name: Key

Code: key

Visibility condition: no

Default: — 

Argument containing the key. It is transmitted to the external system in a message about the start of the component operation (event ivrevents.api_start) and the completion of the component operation (event ivrevents.api_stop).

The external system must indicate this key next to the IVR dialogue identifier in each request sent within the websocket token-api ivrapi in order to externally manage this component.

Name: Parameters Code: params Visibility condition: no

Default: — 

An argument containing additional parameters for the external system.

The specified parameters are transmitted in the message about the start of the component operation (event ivrevents.api_start).

Name: Control take confirmation timeout, ms

Code: reportTimeoutMs

Visibility condition: no Default: 3000

Argument defining the timeout for waiting for confirmation from one of the external systems connected via websocket token api, in milliseconds.

Name: Reason for exit to variable

Code: varReason

Visibility condition: no

Default: — 

Variable where the reason for the component’s shutdown is entered.

Name: Transition Code: transfer Visibility condition: no

Default: — 

The component to which control is transferred after the component is terminated by shutting down the external system.

Name: Transition, time

Code: transferTimeout

Visibility condition: no

Default: — 

The component to which control is transferred upon completion due to a timeout.

Name: Transition, error

Code: transferError

Visibility condition: no

Default: — 

Component to which control is transferred in case of an error.

See also