ВОЙТИ

AppEvents

Events

CallAlerting

Event is triggered when an incoming call arrives. Since each incoming call creates new session, it can be triggered only once during session lifetime

Пример

VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
    // call handling and other logic
  });

Parameters

  • call:

    Call

    Incoming call that triggered the event

  • callerid:

    String

    CallerID for current call

  • customData:

    String

    Optional: Custom data that is passed with the call. It can be passed from Web SDK via the Client.call method in the customData parameter; it works similarly in other SDKs.

  • destination:

    String

    Dialed number

  • displayName:

    String

    Displayable name of the caller

  • fromURI:

    String

    CallerID with domain or SIP URI for incoming SIP call

  • headers:

    Object

    Custom SIP headers received with the call (the ones starting with "X-")

  • name:

    String

    The name of the event - "Application.CallAlerting"

  • scheme:

    Object
  • toURI:

    String

    Dialed SIP URI

HttpRequest

Event is triggered when the managing HTTP request is received by the session. If you start a call session with an HTTP request, you will receive an object with the media_session_access_url property as the answer. The property's value is the managing URL for the specified session, so it can be used in the managing HTTP request that triggers AppEvents.HttpRequest event. Managing HTTP requests are used to stop scenarios or pass additional data into them. For more details see the AppEvents.Started or this article.

Пример

curl -d '{"param1": "value1", "param2": "value2"}' -H "Content-type: application/json" -X POST  http://185.164.148.244:12092/request/1d61f27ba2faad53.1500645140.80028_185.164.148.244/eb4b0539b13e2401

Parameters

  • content:

    String

    HTTP request content. E.g. '{"param1": "value1", "param2": "value2"}'

  • method:

    String

    HTTP request method. E.g. POST

  • path:

    String

    HTTP path requested (without domain name). E.g. /request/1d61f27ba2faad53.1500645140.80028_185.164.148.244/eb4b0539b13e2401

Started

The very first event is triggered due to incoming call or HTTP request to Voximplant cloud over the internet. The event is triggered only once in a session, so if you execute the same HTTP request again it will create the new, separate session. Note that usage of the event in your JS scenario is optional. See the workflow example in this article.

Пример

 https://api.voximplant.com/platform_api/StartScenarios/?account_id=1&api_key=eec36d6c-a0eb-46b5-a006-1c2b65343bac&rule_id=67462  // minimal example of HTTP request
 
 VoxEngine.addEventListener(AppEvents.Started, function() {
   // your code
 });

Parameters

  • accessURL:

    String

    HTTP URL that can be used to send commands to this scenario from the outer world.

  • accountId:

    Number

    unique identification number of Voximplant account. Can be used as one of the authentication parameters in HTTP API methods.

  • applicationId:

    Number

    unique identification number of Voximplant application. Can be used in Managing Applications methods of HTTP API

  • logURL:

    String

    direct link to the call's log

  • sessionId:

    Number

    unique identification number of JS session. Can be used in Managing History methods of HTTP API

  • accessSecureURL:

    String

    HTTPS URL that can be used to send commands to this scenario from the outer world.

Terminated

Event is triggered when a session was terminated and after the AppEvents.Terminating event was triggered. The time between these events depends on handler for AppEvents.Terminating event. Use the event just for debugging, only the Logger.write method could be used in a handler.

Terminating

Event is triggered when a session is about to terminate. The event is triggered in two cases: 1) when there are no calls and/or ACD requests in a call session. See the details in VoxEngine session limits 2) when the VoxEngine.terminate method was called. Timers and any other external resourses are not available after this event was triggered, but you can perform one HTTP request inside the event handler (e.g. to notify external system about the fact that session is finished). When that request is finished (or no such request was made), the AppEvents.Terminated event will be triggered.

WebSocket

Parameters

  • content:

    String

    HTTP request content. E.g. '{"param1": "value1", "param2": "value2"}'

  • method:

    String

    HTTP request method. E.g. POST

  • path:

    String

    HTTP path requested (without domain name). E.g. /request/1d61f27ba2faad53.1500645140.80028_185.164.148.244/eb4b0539b13e2401

  • websocket:

    WebSocket

    WebSocket object that triggered the event.