Overview

Make an outgoing call. This -like all calls in the system- has one end on the server and the other can be a SIP phone or a normal mobile or landline phone. After your call is connected you have to join it with another call with x.join(callId1, callId2);.

Method Calls

Method Returns Description
x.call(phoneNumber:String); the callId of the new call Make an outgoing call to the given number.
x.call(text:String, parameters:Object); the callId of the new call Make an outgoing call to the given number with all the extra parameters in the parametes Object
x.call(numbers:Array); the callId of the new call Make outgoing calls to all the numbers in the array at the same time. When one of them is connected hang up the others. ["2000","3000"] so dial 2000 and 3000 at the same time, whoever picks up first wins, the others are hanged up.
x.call(numbers:Array[Array[]], parameters:Object); the callId of the new call Make outgoing calls to all the numbers in the first array, if no answer from those, call the numbers from the second array and so on. Example: [["1000"],["2000","3000"],["5","6","7"]] so call 1000 first if no answer in timeout time, then dial 2000 and 3000 at the same time, whoever picks up first wins, an so on


Parameters Object

property Mandatory Description
timeout No How long should the server wait for a call to connect. Default is 60 seconds.
callerID No What should the server display to the called as caller number.
onAnswer No Execute this function when the called number picked up.
onHangup No Execute this function when the call we just started hang up.
onCallFailure No Execute this function when the call failed (busy, no answer etc).

Examples

Call 1000 and wait 30 seconds to pick up. If the call was answered, write log.

    var callId = x.call("1000", {
    timeout: 30,
    onAnswer: function() {
      x.log("Called just picked up");
    }
  });
  
call 1000 first if no answer in 30 seconds, then call 2000 and 3000 at the same time. Write log when someone picks up.

    var callId = x.call([["1000"], ["2000","3000"]], {
    timeout: 30,
    onAnswer: function() {
      x.log("Called just picked up");
    }
  });