SIGN UP
Navigation

CallEvents

Events

Event is triggered after remote peer answeredthe call or set the call into the Call.startEarlyMedia state. Note that event is not triggered in P2P mode.

Parameters

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

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

  • name:

    String

    The name of the event - "Call.AudioStarted"

Event is triggered after the incoming/outgoing call is connected. For incoming call, it happens after the Call.answer was called. For outgoing call, it happens when a remote peer answers the call.

Example

 VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  var inc = e.call;
  inc.answer();
  inc.addEventListener(CallEvents.Connected, function(e) {  
    // your code
  });
});

Parameters

  • call:

    Call

    Call that triggered the event

  • customData:

    String

    Optional: Custom data that was passed from client with call accept command

  • name:

    String

    The name of the event - "Call.Connected"

Event is triggered when an established call was terminated. Note that this event doesn't mean the end of the JavaScript session. The session without calls and/or ACD requests will be automatically terminated after some time (see the session limits for details). It's a good idea to explicitly terminate the session with VoxEngine.Terminate() after it's no longer needed.

Example

 VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  var inc = e.call;
  inc.addEventListener(CallEvents.Disconnected, function(e) {
    VoxEngine.terminate();  // terminates the JavaScript session right after disconnection.
  });
});

Parameters

  • call:

    Call

    Call that triggered the event

  • cost:

    number

    Call cost in account currency

  • duration:

    number

    Total call duration in seconds

  • headers:

    Object

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

  • name:

    String

    The name of the event - "Call.Disconnected"

Event is triggered when an outgoing call was terminated before it was connected. Most frequent status codes:

CodeDescription
486Destination number is busy
487Request terminated
603Call was rejected
404Invalid number
480Destination number is unavailable
402Insufficient funds

Parameters

  • call:

    Call

    Call that triggered the event

  • code:

    Number

    Status code of the call (i.e. 486)

  • headers:

    Object

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

  • name:

    String

    The name of the event - "Call.Failed"

  • reason:

    String

    Status message of call failure (i.e. Busy Here)

Event is triggered when the first video packet was received

Parameters

  • call:

    Call

    Call that triggered the event

  • url:

    string

    Record URL

Event is triggered when INFO message is received

Parameters

  • body:

    String

    Content of the message

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

    Optional SIP headers received with the message (the ones starting with "X-")

  • mimeType:

    String

    MIME type of INFO message

  • name:

    String

    The name of the event - "Call.InfoReceived"

Event is triggered when Text Message is received

Parameters

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

    Optional SIP headers received with the message (the ones starting with "X-")

  • name:

    String

    The name of the event - "Call.MessageReceived"

  • text:

    String

    Content of the message

Event is triggered each time when microphone status changes. There is the method for enabling status analyzing - Call.handleMicStatus.

Parameters

  • active:

    Boolean

    Activity flag

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.MicStatusChange"

Event is triggered when call is taken off hold

Parameters

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.OffHold"

Event is triggered when call is put on hold

Parameters

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.OnHold"

Event is triggered when audio/voice playback is completed. Note that the Call.stopPlayback method finishes any media, so the PlaybackFinished event will be not triggered. The playback may be started by the Call.say or Call.startPlayback methods.

Example

 VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  var inc = e.call;
  inc.answer();
  inc.addEventListener(CallEvents.Connected, function(e) {
    inc.say("Good afternoon!", Language.CA_ENGLISH_FEMALE);
    inc.addEventListener(CallEvents.PlaybackFinished, function() {
      VoxEngine.terminate();
    });
  });
});

Parameters

  • call:

    Call

    Call that triggered the event

  • error:

    String

    Optional: Error that occured during the playback

  • name:

    String

    The name of the event - "Call.PlaybackFinished"

Event is triggered when ReInviteAccepted message is accepted

Parameters

  • body:

    String

    Content of the message

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

    Optional SIP headers received with the message (the ones starting with "X-")

  • mimeType:

    String

    MIME type of body data "application/sdp" or "application/json"

  • name:

    String

    The name of the event - "Call.ReInviteAccepted"

Event is triggered when ReInviteReceived message is received

Parameters

  • body:

    String

    Content of the message

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

    Optional SIP headers received with the message (the ones starting with "X-")

  • mimeType:

    String

    MIME type of body data "application/sdp" or "application/json"

  • name:

    String

    The name of the event - "Call.ReInviteReceived"

Event is triggered when ReInviteRejected message is rejected

Parameters

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

    Optional SIP headers received with the message (the ones starting with "X-")

  • name:

    String

    The name of the event - "Call.ReInviteRejected"

Is triggered in case of problems during the recording process

Parameters

  • error:

    string

    Error message

Event is triggered when call recording is started as a result of the Call.record method call.

Example

 VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  var inc = e.call; 
  var out = VoxEngine.callPSTN("+13115552368");
  out.addEventListener(CallEvents.Connected, function() {
    inc.answer();
    VoxEngine.sendMediaBetween(inc, out);
    inc.record({stereo: true});
    inc.addEventListener(CallEvents.RecordStarted, function(e) {
        var url = e.url; // the record will be available in some time via this url
    });
  });
});

Parameters

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.RecordStarted"

  • url:

    String

    HTTP URL of a record file.

Event is triggered when call recording is stopped. This happens after the CallEvents.Disconnected event was triggered.

Example

 VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
     var inc = e.call; 
     var out = VoxEngine.callPSTN("+13115552368");
     out.addEventListener(CallEvents.Connected, function(e) {
       inc.answer();
       VoxEngine.sendMediaBetween(inc, out);
       inc.record({stereo: true});
       inc.addEventListener(CallEvents.RecordStopped, function() {
         VoxEngine.terminate();
       });
     });
   });  

Parameters

  • call:

    Call

    Call that triggered the event

  • cost:

    string

    Record cost (in the account's currency: USD, EUR or RUR)

  • duration:

    number

    Record duration (sec)

  • name:

    String

    The name of the event - "Call.RecordStopped"

  • url:

    String

    HTTP URL of record file.

Event is triggered after outgoing call receives progress signal from a remote peer.

Parameters

  • call:

    Call

    Call that triggered the event

  • headers:

    Object

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

  • name:

    String

    The name of the event - "Call.Ringing"

DEPRECATED || Event is triggered when call statistic changed.

Parameters

  • call:

    Call

    Call that triggered the event

Event is triggered when a tone is detected. There is the method for enabling tone detection - Call.detectProgressTone. Note that: 1) the event is triggered only if the CallEvents.Connected event was triggered 2) the event is only triggered once in a call session.

Parameters

  • VoicemailTone:

    Boolean

    If set to true, the detected tone is a voicemail tone.

  • call:

    Call

    Call thet triggered the event

  • name:

    String

    The name of the event - "Call.ToneDetected"

  • ProgressTone:

    Boolean

    If set to true, the detected tone is a progress tone.

Event is triggered when DTMF signal is received. Note that by default DTMF signals will not trigger this event, this behavior needs to be set explicitly by using the Call.handleTones method.

Parameters

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.ToneReceived"

  • tone:

    String

    Tone received in this event: 0-9,*,# are possible values

Event is triggered when call transfer complete

Parameters

  • call:

    Call

    Call that triggered the event

The event is triggered after the video track created. This could happen only if the Call.record({video: true}) method was called.

Parameters

  • call:

    Call

    Call that triggered the event

  • url:

    string

    Record URL

Event is triggered each time when voicemail tone is detected. The detection is possible if the Call.detectVoicemailTone method was called in the scenario. Note that detection is ended after timeout specified in the method (default value is 20 seconds).

Parameters

  • call:

    Call

    Call that triggered the event

  • frequency:

    Number

    Tone frequency

  • name:

    String

    The name of the event - "Call.VoicemailToneDetected"

Event is triggered when voicemail tone is not detected. The event can be triggered only if the Call.detectVoicemailTone method was called in the scenario. Note that event is triggered strictly after timeout specified in the method (default value is 20 seconds). Possible causes of detection's failure: interferences or dividing of the signal; complex signal (more than one frequency); the signal is out of the supported range (500 - 2000 Hz)

Parameters

  • call:

    Call

    Call that triggered the event

  • name:

    String

    The name of the event - "Call.VoicemailToneNotDetected"