Callback
ViewController
In order for a consultant to work, you need to register a ViewController with the name consultant.
Important: ViewController is registered once for all the online consultant forms
CreateWidget
To create a callback widget, you need to call the method CallGear.UI.createWidget() with the following parameters:
widgetName= 'consultant_sitephone'
Example
CallGear.UI.registerViewController('consultant', function (settings, tpls) {
...
var consultantSipehone = CallGear.UI.createWidget('consultant_sitephone', {
settings: settings,
template: tpls['consultant_sitephone'],
...
});
...
consultantSipehone.render();
});
Method
startCall(data)
This method initiates requesting a call to a specified number.
The data object may contain the following features:
phone- a phone number, that's been dialed. This is a required field.captcha_key- captcha key, received from a server. You need to fill in this field, only if captcha is enabled in the sitephone settings.captcha_value- captcha value entered by a visitor. The field needs to be filled in only if captcha is enabled in the sitephone settings.group_id- ID of the operator group with which to connect a website visitor. This field should be filled in if the option "Process call in accordance with the selected group on the widget" is selected in the callback setting of the processing methoddelayed_call_time- Parameter to make a delayed call. Set in the format n ms, UTC.
Events
sitephonecall
The event occurs after a call is requested. It allows you to find out if the call request was successful.
sitephonecall event reatures: object containing the following fields:
- success -
true, if the call was requested,false, if an error accured - info - an object containing text fields
titleandmessageto display the message to a website visitor.