Overview

Answers or 'picks up' an incoming call. A script can be started by either an incoming call or an http based API call. If you intend to use your script for incoming calls, then x.answer() should be among the first things you do with a call. Do not use answer when making outbound calls.

Method Calls

Method Returns Description
x.answer(); the callId of the answered call Accept or pick up the incoming call. As you can see there are no parameters here, because the callId the system will answer in this case is the current calls id. If this script was started by an incoming call, then the current callId will automatically be set for you.
x.answer(callId:String); the callId of the answered call Accept and pick up the incoming call which has the callId
x.answer(parameters:Object); the callId of the answered call Accept or pick up the incoming call. Answer the current calls id. If this script was started by an incoming call, then the current callId will automatically be set for you.


Parameters Object

property Mandatory Description
onHangup No Execute this function when the call we just started hang up.

Examples

Answer the current incoming call

    var callId = x.answer();
    x.log("The callId of the answered call is: " + callId);
  
Answer the current incoming call with parameters. Hang up all calls when the incoming call is hang up.

    var callId = x.answer({
    onHangup:function() {
      x.hangupAll();
    },
   });
    x.log("The callId of the answered call is: " + callId);