This is a function of the Call JavaScript API that allows you to specify the parameters that you wish to have available while using the Call JavaScript API. These parameters can include information about the visitor and functions that may be called at various stages of the call.
You can call the function using the following code:
var mycall = livehelp.Call( callOptions );
This calls the functions with the parameters passed as properties of the callOptions object.
The following sample shows how to use the callOptions object to pass the parameters:
var callOptions = {
// REQUIRED ARGS
target: "18001234567",
contactId: "123456",
// OPTIONAL ARGS
language: "en",
extension: "1234",
delay: 30,
callState: {
initiated: myInitiatedFunction,
connecting: myConnectingFunction,
connected: myConnectedFunction,
disconnected: myDisconnectedFunction,
error: myErrorFunction
},
optionalData: {
cartTotal: "100.00",
orderId: "A102329"
customerId: "G12387"
}
};
The properties available in the callOptions object are:
Property | Type | Required | Default | Description |
---|---|---|---|---|
target | String | Yes | N/A | Telephone number, in E.164 format. |
contactId | String | Yes | N/A | The ID of a link which has been configured in Webcare. |
language | String | No | “en” | Two-letter country code from ISO 3166-1. |
delay | Number | No | 0 | Delay (in seconds) until the server will attempt to place the call. The maximum value for this property is 900 seconds (15 minutes). |
extension | String | No | ““ | The end user’s telephone extension, if relevant. The permitted characters in this field are the digits 0-9, “.”, “,”, “*” and “#”. |
callState | Object | No | N/A | An object containing up to four functions, to be called at each stage of the call. This allows for integration of applications like Google Analytics. |
callState.initiated | Function | No | N/A | A user-defined function that is called immediately after the start() method is invoked. |
callState.connecting | Function | No | N/A | A user-defined function that will be called while the call is connecting. This happens after the connection has been made to the Live Help servers, and they have indicated that the call has been initiated, i.e. it does not happen immediately after the start() method has been invoked. |
callState.connected | Function | No | N/A | A user-defined function that is called once both legs of the call are connected. |
callState.disconnected | Function | No | N/A | A user-defined function that is called when the call has been disconnected. This function may be called even if the connected function has not been called first, for example, if the user or agent does not answer. |
callState.error | Function | No | N/A | A user-defined function that will be called in the event of an error. |
optionalData | Object | No | N/A | An object containing a number of variables that you wish to store server-side, associated with the call. Examples may include any shopping cart total, the product ID of something a customer is viewing, etc. |